/* ============================================================
   WIDGETS.CSS — интерактивные виджеты сайдбара (страницы снов)
   Совместимость знаков · Карта дня (Таро) · Лунный календарь
   ============================================================ */

[hidden] { display: none !important; }

/* --- Общая карточка виджета --- */
.widget-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    max-width: 100%;
    overflow-wrap: break-word;
}

.widget-hint {
    font-size: 12px;
    line-height: 1.55;
    color: var(--text-muted);
    margin-bottom: 14px;
}

.w-btn {
    display: block;
    width: 100%;
    padding: 11px 16px;
    margin-top: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: var(--transition);
}

.w-btn:hover {
    box-shadow: 0 6px 20px var(--accent-glow);
    transform: translateY(-1px);
}

.w-btn:active { transform: translateY(0); }

.w-note {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ============================================================
   1. СОВМЕСТИМОСТЬ ЗНАКОВ ЗОДИАКА
   ============================================================ */
.zw-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.zw-select {
    flex: 1;
    min-width: 0;
    padding: 10px 10px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}

.zw-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.zw-select option { background: #14142c; color: var(--text-primary); }

.zw-sep {
    color: var(--accent);
    font-size: 12px;
    flex-shrink: 0;
}

.zw-result {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
}

.zw-signs {
    display: block;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.zw-signs i { color: var(--accent); font-size: 11px; margin: 0 2px; }

.zw-score {
    font-family: var(--font-display);
    font-size: 44px;
    font-weight: 700;
    line-height: 1;
}

.zw-score span {
    font-size: 20px;
    margin-left: 2px;
    opacity: 0.7;
}

.zw-track {
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin: 12px 0 8px;
}

.zw-bar {
    display: block;
    height: 100%;
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.zw-verdict {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}

.zw-text {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.zw-elements {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.zw-elements span {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

/* ============================================================
   2. КАРТА ДНЯ (ТАРО)
   ============================================================ */
.tarot-stage {
    position: relative;
    height: 170px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.tarot-stage:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
    border-radius: 12px;
}

.tarot-deck {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    height: 150px;
    transform: translate(-50%, -50%);
    transition: opacity 0.4s, transform 0.4s;
}

.tarot-back {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    background: linear-gradient(150deg, #241d4d, #3a2f74);
    border: 1px solid rgba(167, 139, 250, 0.35);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
}

.tarot-back::after {
    content: '✦';
    color: rgba(232, 192, 120, 0.8);
    font-size: 18px;
}

.tarot-back:nth-child(1) { transform: translate(-14px, -6px) rotate(-8deg); }
.tarot-back:nth-child(2) { transform: translate(-9px, -3px) rotate(-4.5deg); }
.tarot-back:nth-child(3) { transform: translate(-4px, -1px) rotate(-1.5deg); }
.tarot-back:nth-child(4) { transform: translate(4px, 1px) rotate(1.5deg); }
.tarot-back:nth-child(5) { transform: translate(9px, 3px) rotate(4.5deg); }
.tarot-back:nth-child(6) { transform: translate(14px, 6px) rotate(8deg); }

.tarot-deck.is-shuffling { animation: tarotShuffle 0.6s ease-in-out; }

@keyframes tarotShuffle {
    0%   { transform: translate(-50%, -50%) rotate(0) scale(1); }
    25%  { transform: translate(-50%, -50%) rotate(-3deg) scale(1.04); }
    50%  { transform: translate(-50%, -50%) rotate(3deg) scale(1.07); }
    75%  { transform: translate(-50%, -50%) rotate(-2deg) scale(1.04); }
    100% { transform: translate(-50%, -50%) rotate(0) scale(1); }
}

.tarot-deck.is-drawn {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.75);
}

.tarot-played {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 100px;
    height: 150px;
    border-radius: 14px;
    background: linear-gradient(160deg, #1d1745, #2c2464);
    border: 1px solid rgba(167, 139, 250, 0.45);
    box-shadow: 0 10px 30px rgba(108, 99, 255, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transform: translate(-50%, -50%);
    opacity: 0;
    pointer-events: none;
}

.tarot-played.is-shown {
    opacity: 1;
    animation: tarotFlip 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
}

@keyframes tarotFlip {
    from { transform: translate(-50%, -50%) rotateY(90deg) scale(0.9); opacity: 0; }
    to   { transform: translate(-50%, -50%) rotateY(0) scale(1); opacity: 1; }
}

.tarot-num {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #e8c07a;
}

.tarot-sym { font-size: 42px; line-height: 1; }

.tw-result {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.tw-name {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tw-kw {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--accent-light);
    margin-bottom: 10px;
}

.tw-mean {
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tw-advice {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-primary);
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(212, 160, 84, 0.06));
    border-left: 2px solid var(--accent);
}

.tw-advice i { color: var(--gold); margin-right: 4px; }

/* ============================================================
   3. ЛУННЫЙ КАЛЕНДАРЬ
   ============================================================ */
.lunar-loading {
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
    padding: 10px 0;
}

.lunar-top {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.lunar-emoji {
    font-size: 44px;
    line-height: 1;
    flex-shrink: 0;
    filter: drop-shadow(0 0 14px rgba(232, 192, 120, 0.35));
}

.lunar-main { min-width: 0; }

.lunar-phase {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.lunar-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: capitalize;
}

.lunar-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

.lunar-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.lunar-facts span {
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.lunar-facts i { color: var(--accent); margin-right: 4px; font-size: 11px; }

.lunar-text {
    font-size: 13px;
    line-height: 1.65;
    color: var(--text-secondary);
    margin-bottom: 14px;
}

.lunar-strip {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 10px;
}

.lunar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 6px 2px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
}

.lunar-day span {
    font-size: 9px;
    color: var(--text-muted);
    white-space: nowrap;
}

.lunar-day em { font-size: 15px; font-style: normal; line-height: 1; }

.lunar-day.is-today {
    background: rgba(139, 92, 246, 0.14);
    border-color: rgba(139, 92, 246, 0.4);
}

.lunar-note {
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-muted);
    opacity: 0.8;
}

/* ============================================================
   ОБЩИЕ ЭЛЕМЕНТЫ ФОРМ И ВКЛАДОК
   ============================================================ */
.wtabs { margin-top: 2px; }

.wtabs-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.wtabs-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 6px;
    border: none;
    border-radius: 9px;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.wtabs-btn i { font-size: 11px; }
.wtabs-btn:hover { color: var(--text-secondary); }

.wtabs-btn.is-active {
    background: linear-gradient(135deg, var(--accent), #a855f7);
    color: #fff;
    box-shadow: 0 4px 14px var(--accent-glow);
}

.wtabs-panel { display: none; }

.wtabs-panel.is-active {
    display: block;
    animation: wtFade 0.35s ease both;
}

@keyframes wtFade {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: none; }
}

.w-field { display: block; margin-bottom: 14px; }

.w-field > span {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.w-field > span small { font-size: 11px; color: var(--text-muted); }

.w-input {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    transition: var(--transition);
}

.w-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.w-input::-webkit-calendar-picker-indicator {
    filter: invert(0.65);
    cursor: pointer;
}

.w-link {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 6px;
    border: none;
    background: none;
    color: var(--accent-light);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
}

.w-link:hover { color: #fff; }
.w-link i { margin-right: 4px; }

/* ============================================================
   4. АСТРО-ПРОГНОЗ: ГОРОСКОП НА СЕГОДНЯ
   ============================================================ */
.hz-out,
.nm-out,
.sc-out {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.hz-out:empty,
.nm-out:empty,
.sc-out:empty {
    margin: 0;
    padding: 0;
    border: none;
}

.hz-out { margin-top: 12px; }

.hz-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.hz-emoji {
    font-size: 30px;
    line-height: 1;
    flex-shrink: 0;
}

.hz-sign {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.hz-date { font-size: 11px; color: var(--text-muted); }

.hz-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.hz-row i {
    color: var(--accent);
    width: 14px;
    flex-shrink: 0;
    margin-top: 3px;
    font-size: 12px;
    text-align: center;
}

.hz-row span { font-size: 13px; line-height: 1.55; }

.hz-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
}

.hz-tags span {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--glass);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.hz-note {
    font-size: 10px;
    line-height: 1.4;
    color: var(--text-muted);
    opacity: 0.75;
    margin-top: 10px;
}

/* ============================================================
   4b. НУМЕРОЛОГИЯ ДНЯ
   ============================================================ */
.nm-score {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}

.nm-num {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #a855f7);
    box-shadow: 0 6px 18px var(--accent-glow);
}

.nm-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.25;
}

.nm-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.nm-text { font-size: 13px; line-height: 1.6; margin-bottom: 10px; }

.nm-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nm-list span { font-size: 12px; color: var(--text-secondary); }
.nm-list b { color: var(--text-primary); }

/* ============================================================
   5a. КАЛЬКУЛЯТОР СНА
   ============================================================ */
.sc-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.sc-times {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.sc-time {
    flex: 1 1 calc(50% - 4px);
    min-width: 96px;
    text-align: center;
    padding: 8px 6px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.sc-time b {
    display: block;
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text-primary);
    line-height: 1.2;
}

.sc-time em {
    font-style: normal;
    font-size: 10px;
    color: var(--text-muted);
}

.sc-note {
    font-size: 11px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ============================================================
   5b. ТЕСТ «КАКОЙ ВЫ СНОВИДЕЦ»
   ============================================================ */
.qt-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
    margin-bottom: 14px;
}

.qt-progress span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), #a855f7);
    transition: width 0.35s ease;
}

.qt-step {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.qt-q {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.qt-opts {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.qt-opt {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 13px;
    line-height: 1.45;
    cursor: pointer;
    transition: var(--transition);
}

.qt-opt:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--accent);
    color: var(--text-primary);
}

.qt-result-emoji {
    font-size: 40px;
    line-height: 1;
    text-align: center;
    margin-bottom: 8px;
}

.qt-result-name {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 10px;
}

.qt-result-text {
    font-size: 13px;
    line-height: 1.65;
    margin-bottom: 14px;
}

/* ============================================================
   3b. ЛУННЫЙ КАЛЕНДАРЬ НА МЕСЯЦ
   ============================================================ */
.lunar-month-title {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    text-transform: capitalize;
    margin-bottom: 12px;
}

.lunar-month-head,
.lunar-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.lunar-month-head { margin-bottom: 6px; }

.lunar-month-head span {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-muted);
    text-align: center;
}

.lunar-month-grid { margin-bottom: 10px; }

.lunar-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 5px 2px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
}

.lunar-cell.is-empty { background: transparent; }

.lunar-cell b {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1;
}

.lunar-cell em { font-size: 13px; font-style: normal; line-height: 1; }

.lunar-cell.is-today {
    background: rgba(139, 92, 246, 0.16);
    border-color: rgba(139, 92, 246, 0.45);
}

.lunar-cell.is-today b { color: var(--text-primary); font-weight: 700; }

.lunar-cell.is-key { border-color: rgba(232, 192, 120, 0.4); }

/* ============================================================
   МОБИЛЬНАЯ ВЕРСИЯ: виджеты под статьёй, на всю ширину
   ============================================================ */
@media (max-width: 900px) {
    .sidebar-extras {
        width: 100%;
        max-width: 620px;
        margin: 28px auto 0;
    }
    .widget-card { padding: 22px; }

    /* Сайдбар перенесён скриптом сразу под первый сон — сохраняем
       визуальный разделитель перед следующим загруженным сном. */
    .sidebar + .dream-auto-page {
        margin-top: 32px;
        padding-top: 32px;
        border-top: 1px solid var(--border);
    }

    .zw-signs { font-size: 14px; }
    .lunar-emoji { font-size: 52px; }
    .lunar-phase { font-size: 22px; }
    .tarot-stage { height: 190px; }
    .tarot-deck,
    .tarot-played { width: 112px; height: 168px; }
    .tarot-sym { font-size: 48px; }

    .wtabs-btn { font-size: 13px; padding: 9px 8px; }
    .qt-q { font-size: 15px; }
    .qt-opt { font-size: 14px; }
    .sc-time b { font-size: 20px; }
    .lunar-cell em { font-size: 15px; }
    .lunar-cell b { font-size: 11px; }
}
