/* ==========================================================================
   [RU] СТИЛИ МОДУЛЯ ЦИТИРОВАНИЯ И ОТКРЫТОК ПРИ ВЫДЕЛЕНИИ ТЕКСТА v1.0 (Стиль «Церковный листок»)
   [EN] TEXT SELECTION QUOTE SHARING & CARD LAUNCHER STYLES v1.0 ("Church Leaflet" Aesthetic)
   ========================================================================== */

.lestvica-qs-root {
    --qs-bg: #fdfaf5;
    --qs-bg-bottom: #f6efe3;
    --qs-surface-hover: rgba(212, 175, 55, 0.13);
    --qs-text: #3a3128;
    --qs-text-muted: #7a6e5f;
    --qs-head: #2b2118;
    --qs-gold: #d4af37;
    --qs-gold-dark: #a68221;
    --qs-burgundy: #7a1c1c;
    --qs-border: rgba(212, 175, 55, 0.48);
    --qs-divider: rgba(166, 130, 33, 0.22);
    --qs-shadow: 0 14px 36px rgba(42, 31, 18, 0.22), 0 3px 10px rgba(42, 31, 18, 0.1);
    --qs-top: 80px;
    --qs-right: 52px;

    position: fixed;
    top: var(--qs-top);
    right: var(--qs-right);
    z-index: 9995;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
    font-family: 'Lora', Georgia, 'Times New Roman', serif;
    box-sizing: border-box;
}

.lestvica-qs-root[hidden],
.lestvica-qs-root.is-hidden-by-hermit {
    display: none !important;
}

.lestvica-qs-root *,
.lestvica-qs-root *::before,
.lestvica-qs-root *::after {
    box-sizing: border-box;
}

/* =======================================================
   [RU] ВЫПЛЫВАЮЩАЯ ИЗ-ПОД МЕНЮ ПЛАШКА (АНАЛОГ МОДУЛЯ ИСТОРИИ)
   [EN] SLIDE-DOWN PANEL EMERGING FROM BENEATH THE MENU
   ======================================================= */
.lestvica-qs-panel {
    pointer-events: none;
    width: 360px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - var(--qs-top) - 18px);
    overflow-y: auto;
    background: linear-gradient(180deg, var(--qs-bg) 0%, var(--qs-bg-bottom) 100%);
    color: var(--qs-text);
    border: 1px solid var(--qs-border);
    border-top: none;
    border-radius: 0 0 14px 14px;
    box-shadow: var(--qs-shadow);
    transform-origin: top right;
    transform: translateY(-16px) scaleY(0.94);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.22s ease,
                visibility 0.22s ease;
}

.lestvica-qs-root.is-open .lestvica-qs-panel {
    pointer-events: auto;
    transform: translateY(0) scaleY(1);
    opacity: 1;
    visibility: visible;
}

/* [RU] Тонкая золотая нить на стыке с верхним меню */
/* [EN] Thin golden thread along the top edge */
.lestvica-qs-gold-thread {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, rgba(212, 175, 55, 0.35) 0%, #d4af37 50%, rgba(212, 175, 55, 0.35) 100%);
}

/* [RU] Шапка плашки */
/* [EN] Panel header */
.lestvica-qs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 9px 15px;
    border-bottom: 1px solid var(--qs-divider);
    background: rgba(212, 175, 55, 0.07);
}

.lestvica-qs-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.lestvica-qs-header-icon {
    width: 15px;
    height: 15px;
    color: var(--qs-burgundy);
    flex: 0 0 auto;
}

.lestvica-qs-title {
    font-family: 'Playfair Display', 'Lora', Georgia, serif;
    font-size: 14.5px;
    font-weight: 700;
    color: var(--qs-head);
    letter-spacing: 0.3px;
}

.lestvica-qs-close-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    border-radius: 50% !important;
    color: var(--qs-text-muted) !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease !important;
}

.lestvica-qs-close-btn svg {
    width: 15px;
    height: 15px;
    display: block;
}

.lestvica-qs-close-btn:hover {
    background: rgba(212, 175, 55, 0.16) !important;
    border-color: var(--qs-border) !important;
    color: var(--qs-burgundy) !important;
}

/* =======================================================
   [RU] ПРЕВЬЮ ВЫДЕЛЕННОГО ТЕКСТА
   [EN] SELECTED QUOTE PREVIEW
   ======================================================= */
.lestvica-qs-preview-box {
    padding: 10px 15px;
    border-bottom: 1px dashed var(--qs-divider);
    background: rgba(255, 253, 249, 0.65);
}

.lestvica-qs-preview-text {
    font-family: 'Lora', Georgia, serif;
    font-size: 13px;
    font-style: italic;
    line-height: 1.48;
    color: var(--qs-text);
    padding-left: 10px;
    border-left: 2px solid var(--qs-gold);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* =======================================================
   [RU] ПУТЬ 1: ОТПРАВКА ПРОСТОЙ ЦИТАТЫ ЧЕРЕЗ СОЦКНОПКИ
   [EN] PATH 1: PLAIN QUOTE SHARING VIA SOCIAL BUTTONS
   ======================================================= */
.lestvica-qs-section {
    padding: 11px 15px 12px 15px;
    border-bottom: 1px solid var(--qs-divider);
}

.lestvica-qs-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.lestvica-qs-section-label {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--qs-text-muted);
}

.lestvica-qs-copy-btn {
    padding: 3px 8px !important;
    margin: 0 !important;
    min-height: auto !important;
    height: auto !important;
    background: rgba(212, 175, 55, 0.11) !important;
    color: var(--qs-head) !important;
    border: 1px solid rgba(166, 130, 33, 0.35) !important;
    border-radius: 6px !important;
    font-family: system-ui, -apple-system, sans-serif !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    line-height: 1.3 !important;
    text-transform: none !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease !important;
}

.lestvica-qs-copy-btn:hover {
    background: rgba(212, 175, 55, 0.24) !important;
    border-color: var(--qs-gold) !important;
    color: var(--qs-burgundy) !important;
}

.lestvica-qs-social-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    justify-items: center;
}

.lestvica-qs-share-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    padding: 3px !important;
    margin: 0 !important;
    background: rgba(255, 255, 255, 0.55) !important;
    border: 1px solid rgba(166, 130, 33, 0.22) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    box-shadow: none !important;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease !important;
}

.lestvica-qs-share-btn:hover {
    background: #ffffff !important;
    border-color: var(--qs-gold) !important;
    transform: translateY(-2px) scale(1.06);
    box-shadow: 0 4px 10px rgba(42, 31, 18, 0.14) !important;
}

.lestvica-qs-share-btn img {
    width: 26px !important;
    height: 26px !important;
    object-fit: contain !important;
    border-radius: 50% !important;
    display: block !important;
    margin: 0 !important;
}

/* =======================================================
   [RU] ПУТЬ 2: КНОПКА ЗАПУСКА ГЕНЕРАТОРА ОТКРЫТОК
   [EN] PATH 2: LAUNCH BUTTON FOR CARD GENERATOR
   ======================================================= */
.lestvica-qs-card-section {
    padding: 11px 15px 13px 15px;
    background: rgba(166, 130, 33, 0.05);
}

.lestvica-qs-card-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 9px !important;
    width: 100% !important;
    min-height: 40px !important;
    height: auto !important;
    padding: 10px 14px !important;
    margin: 0 !important;
    background: linear-gradient(180deg, #8b2323 0%, #6f1919 100%) !important;
    color: #fdfaf5 !important;
    border: 1px solid rgba(212, 175, 55, 0.65) !important;
    border-radius: 9px !important;
    font-family: 'Lora', Georgia, serif !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.25 !important;
    letter-spacing: 0.25px !important;
    text-transform: none !important;
    cursor: pointer !important;
    box-shadow: 0 4px 14px rgba(122, 28, 28, 0.22) !important;
    transition: transform 0.18s ease, box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease !important;
}

.lestvica-qs-card-btn:hover {
    filter: brightness(1.07);
    box-shadow: 0 6px 18px rgba(122, 28, 28, 0.3) !important;
    transform: translateY(-1px);
}

.lestvica-qs-card-btn:disabled {
    opacity: 0.72;
    cursor: wait !important;
    transform: none !important;
}

.lestvica-qs-card-btn-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
    color: #f3d78a;
}

/* =======================================================
   [RU] АККУРАТНОЕ УВЕДОМЛЕНИЕ (TOAST)
   [EN] NEAT TOAST NOTIFICATION
   ======================================================= */
.lestvica-qs-toast {
    position: fixed;
    bottom: 26px;
    left: 50%;
    transform: translateX(-50%) translateY(14px);
    z-index: 999995;
    max-width: calc(100vw - 28px);
    padding: 10px 18px;
    background: linear-gradient(180deg, #fdfaf5 0%, #f5eddf 100%);
    color: #2b2118;
    border: 1px solid rgba(212, 175, 55, 0.65);
    border-left: 3px solid #d4af37;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(32, 22, 12, 0.24);
    font-family: 'Lora', Georgia, serif;
    font-size: 13.5px;
    line-height: 1.4;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.24s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.lestvica-qs-toast[hidden] {
    display: none !important;
}

.lestvica-qs-toast.is-visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* =======================================================
   [RU] МОБИЛЬНАЯ АДАПТАЦИЯ (<= 1024px) — ПО ЦЕНТРУ ПОД МЕНЮ
   [EN] MOBILE ADAPTATION (<= 1024px) — CENTERED BENEATH MENU
   ======================================================= */
@media (max-width: 1024px) {
    .lestvica-qs-root {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 0;
        height: 0;
    }

    .lestvica-qs-panel {
        position: fixed !important;
        top: var(--qs-top) !important;
        left: 50% !important;
        right: auto !important;
        width: calc(100vw - 24px) !important;
        max-width: 360px !important;
        max-height: calc(100vh - var(--qs-top) - 16px) !important;
        transform-origin: top center !important;
        transform: translate(-50%, -14px) scaleY(0.94) !important;
    }

    .lestvica-qs-root.is-open .lestvica-qs-panel {
        transform: translate(-50%, 0) scaleY(1) !important;
    }

    .lestvica-qs-social-grid {
        gap: 6px;
    }

    .lestvica-qs-share-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
    }

    .lestvica-qs-share-btn img {
        width: 24px !important;
        height: 24px !important;
    }
}