/* ============================================================
   SenseStars · Editorial v3 · Раздел «Ба Цзы» (bazi)
   ----------------------------------------------------------------
   Скоупаны на body.app[data-section="bazi"]; чтобы не задеть
   другие экраны.
   ============================================================ */

/* ── Прячем старое окружение, оно конфликтует с Editorial ── */
body.app[data-section="bazi"] #dynamic-bg,
body.app[data-section="bazi"] #oracle-glow,
body.app[data-section="bazi"] #magic-particles {
    display: none;
}
body.app[data-section="bazi"] > header.legacy-header {
    display: none;
}
body.app[data-section="bazi"] .top-pills-v3,
body.app[data-section="bazi"] .top-pills-v3-diary,
body.app[data-section="bazi"] .top-pills-v3-conn,
body.app[data-section="bazi"] .top-pills-v3-evol {
    display: none;
}

/* ── Раздел Ба Цзы: голос/тон ── */
body.app[data-section="bazi"] {
    --section-voice: #b87333;
    --section-bg: #1c1914;
    --halo-color: rgba(184, 115, 51, 0.09);
    background: var(--section-bg, var(--bg));
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
    color: var(--text);
}

body.app[data-section="bazi"] #app-content {
    max-width: 420px;
    margin: 0 auto;
    padding: 0 0 110px;
    position: relative;
    z-index: 1;
    background: var(--section-bg, var(--bg));
}

/* ── Контейнер экрана ── */
.bazi-screen {
    padding: 0 0 110px;
}

/* ── Форма ввода ── */
.bazi-form {
    padding: 0 24px;
}

.bazi-form-group {
    margin-bottom: 18px;
}

.bazi-form-group label {
    display: block;
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bazi-form-group input[type="date"],
.bazi-form-group input[type="time"],
.bazi-form-group input[type="text"] {
    width: 100%;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-family: var(--sans);
    font-size: 14px;
    color: var(--text);
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.bazi-form-group input[type="date"]:focus,
.bazi-form-group input[type="time"]:focus,
.bazi-form-group input[type="text"]:focus {
    border-color: var(--section-voice, #b87333);
}

.bazi-form-group input[type="date"]:disabled,
.bazi-form-group input[type="time"]:disabled {
    opacity: 0.4;
}

.bazi-form-group input[type="date"]::-webkit-calendar-picker-indicator,
.bazi-form-group input[type="time"]::-webkit-calendar-picker-indicator {
    filter: invert(0.7);
}

/* Чекбокс «время приблизительное» */
.bazi-approx-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0;
    text-transform: none;
    font-weight: 400;
    cursor: pointer;
}

.bazi-approx-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    accent-color: #b87333;
    flex-shrink: 0;
    cursor: pointer;
}

/* Пол — радиокнопки */
.bazi-gender-radio {
    display: flex;
    gap: 12px;
}

.bazi-gender-radio label {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text-dim);
    cursor: pointer;
    flex: 1;
    transition: border-color 0.2s, color 0.2s;
}

.bazi-gender-radio input[type="radio"] {
    accent-color: #b87333;
}

.bazi-gender-radio label:has(input:checked) {
    border-color: #b87333;
    color: var(--text);
}

/* Автокомплит городов */
.city-suggestions {
    background: var(--bg-elev-2);
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    margin-top: 4px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.city-suggestion-item {
    padding: 11px 14px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    transition: background 0.15s, color 0.15s;
}

.city-suggestion-item:last-child {
    border-bottom: none;
}

.city-suggestion-item:active,
.city-suggestion-item:hover {
    background: rgba(184, 115, 51, 0.08);
    color: var(--text);
}

/* Кнопка расчёта */
.bazi-submit-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px 24px;
    background: #b87333;
    color: #15110a;
    border: none;
    border-radius: 12px;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
}

.bazi-submit-btn:active {
    transform: scale(0.98);
}

.bazi-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Спиннер внутри кнопки */
.bazi-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(21, 17, 10, 0.35);
    border-top-color: #15110a;
    border-radius: 50%;
    animation: bazi-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 8px;
}

@keyframes bazi-spin {
    to { transform: rotate(360deg); }
}

/* Сообщение об ошибке */
.bazi-error {
    color: var(--signal-warn);
    font-size: 13px;
    margin-top: 10px;
    display: none;
    line-height: 1.5;
}

/* ── Результат: шапка ── */
.bazi-screen-header {
    padding: 24px 24px 0;
}

/* ── 4 столпа ── */
.bazi-pillars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 16px 24px 0;
}

.bazi-pillar-card {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    transition: border-color 0.2s;
}

.bazi-pillar-card.day-master {
    border-color: #b87333;
    background: rgba(184, 115, 51, 0.06);
}

.bazi-pillar-label {
    font-family: var(--sans);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.bazi-pillar-gan {
    font-family: var(--serif);
    font-size: 32px;
    line-height: 1.05;
    color: var(--text);
    margin-bottom: 2px;
}

.bazi-pillar-card.day-master .bazi-pillar-gan {
    color: #b87333;
}

.bazi-pillar-zhi {
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.1;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.bazi-pillar-ru {
    font-family: var(--sans);
    font-size: 9px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* ── Мастер дня ── */
.bazi-day-master-title {
    font-family: var(--serif);
    font-size: 22px;
    font-weight: 500;
    color: #b87333;
    padding: 14px 24px 0;
    line-height: 1.2;
}

/* ── Подзаголовки секций ── */
.bazi-section-title {
    font-family: var(--serif);
    font-size: 18px;
    font-weight: 500;
    color: var(--text);
    padding: 20px 24px 8px;
    margin: 0;
    line-height: 1.2;
}

/* ── Диаграмма пяти элементов ── */
.bazi-elements-bar {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 24px;
}

.bazi-element-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bazi-element-label {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-dim);
    width: 50px;
    flex-shrink: 0;
}

.bazi-element-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    overflow: hidden;
}

.bazi-element-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.5s ease;
}

.bazi-element-count {
    font-family: var(--serif);
    font-size: 13px;
    color: var(--text-muted);
    width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Текст интерпретации ── */
.bazi-interpretation {
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.65;
    color: var(--text-dim);
    padding: 14px 24px 0;
    border-left: 2px solid rgba(184, 115, 51, 0.35);
    margin: 12px 24px 0;
    padding-left: 14px;
}

/* ── Большие циклы ── */
.bazi-dayun-list {
    padding: 0 24px;
}

.bazi-dayun-item {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--line);
}

.bazi-dayun-item:last-child {
    border-bottom: none;
}

.bazi-dayun-item.current {
    background: rgba(184, 115, 51, 0.07);
    border-bottom-color: rgba(184, 115, 51, 0.25);
    margin: 0 -24px;
    padding: 11px 24px;
    border-left: 3px solid #b87333;
}

.bazi-dayun-age {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-muted);
    width: 68px;
    flex-shrink: 0;
}

.bazi-dayun-name {
    font-family: var(--serif);
    font-size: 16px;
    color: var(--text);
    flex: 1;
}

.bazi-dayun-god {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-muted);
}

/* ── Дисклеймер ── */
.bazi-disclaimer {
    font-family: var(--sans);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    padding: 20px 24px 8px;
    line-height: 1.5;
}

/* ── Кнопка «Пересчитать» ── */
.bazi-reset-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: var(--sans);
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    padding: 8px 24px 16px;
    text-align: center;
    transition: color 0.2s;
}

.bazi-reset-btn:active {
    color: var(--text-dim);
}

/* ── Состояние пустого часа ── */
.bazi-pillar-card.hour-unknown .bazi-pillar-gan,
.bazi-pillar-card.hour-unknown .bazi-pillar-zhi {
    color: var(--text-muted);
    opacity: 0.45;
}
