/* ============================================================
   AI-panda Glossary — интеграция с дизайн-системой темы
   Версия 1.8.1
   ============================================================ */

.aipg-wrapper { --aipg-gap: var(--spacing-lg, 24px); }

/* Заголовок раздела */
.aipg-header { margin-bottom: var(--spacing-lg, 24px); }

.aipg-subtitle {
    color: var(--color-text-muted, #6B7280);
    margin: 0 0 var(--spacing-lg, 24px);
    font-size: 15px;
}

/* ============================================================
   Поиск глоссария
   ============================================================ */
.aipg-search-wrap {
    margin-bottom: var(--spacing-lg, 24px);
}

.aipg-search {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 560px;
    padding: 6px;
    background: #F9F9F9;
    border: 1px solid #EEEEEE;
    border-radius: 8px;
    transition: border-color .2s, box-shadow .2s, background .2s;
}
.aipg-search:focus-within {
    background: #FFFFFF;
    border-color: var(--color-primary-start, #0ABAB5);
    box-shadow: 0 0 0 3px rgba(10, 186, 181, 0.12);
}

.aipg-search input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    background: transparent;
    font-family: var(--font-primary, sans-serif);
    font-size: 15px;
    color: var(--color-text-primary, #111);
    min-width: 0;
}
.aipg-search input::placeholder {
    color: #9CA3AF;
}

.aipg-search button {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 120px;
    padding: 12px 24px;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-family: var(--font-primary, sans-serif);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}
.aipg-search button:hover {
    filter: brightness(1.06);
}
.aipg-search button:active {
    transform: scale(0.98);
}
.aipg-search button svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.aipg-search--full {
    max-width: 100%;
}

.aipg-search-hint {
    display: block;
    margin-top: 8px;
    color: #9CA3AF;
    font-size: 12px;
    line-height: 1.4;
}

/* ============================================================
   Алфавит
   ============================================================ */
.aipg-alphabet {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 1.25rem 0 1.75rem;
    padding: 12px;
    background: linear-gradient(135deg, #F0FDFA 0%, #FFFFFF 100%);
    border: 1px solid rgba(10, 186, 181, 0.15);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0,0,0,.04));
}
.aipg-letter {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 6px 12px;
    border-radius: 8px;
    background: #F3F4F6;
    color: var(--color-text-primary, #111);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    transition: background .15s, color .15s, transform .15s;
}
.aipg-letter:hover {
    background: var(--primary-gradient);
    color: #fff;
    transform: translateY(-1px);
    text-decoration: none;
}
.aipg-letter.is-empty {
    opacity: .35;
    pointer-events: none;
}
.aipg-letter sup {
    font-size: .68em;
    font-weight: 500;
    opacity: .8;
}
.aipg-letter:hover sup { opacity: 1; }

/* Группы по буквам */
.aipg-group { margin-bottom: 1.75rem; }
.aipg-group__title {
    font-size: 22px;
    font-weight: 700;
    margin: 1.5rem 0 .75rem;
    padding-bottom: .25rem;
    border-bottom: 2px solid var(--color-border, #E5E7EB);
    color: var(--color-text-primary, #111);
}

.aipg-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.aipg-item {
    list-style: none;
    padding: 12px 0;
    border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.aipg-item:last-child { border-bottom: none; }
.aipg-item__link {
    font-size: 17px;
    font-weight: 600;
    color: var(--color-text-primary, #111);
    text-decoration: none;
}
.aipg-item__link:hover {
    color: var(--color-link, #0ABAB5);
    text-decoration: underline;
}
.aipg-item__def {
    margin: 4px 0 0;
    color: var(--color-text-muted, #6B7280);
    font-size: 14px;
    line-height: 1.5;
}

.aipg-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--color-text-muted, #6B7280);
}

/* ============================================================
   Single term
   ============================================================ */
.aipg-single-wrapper { margin-top: 30px; }

.aipg-term {
    background: var(--color-bg-primary, #fff);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: var(--radius-lg, 16px);
    padding: var(--spacing-xl, 32px);
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0,0,0,.04));
}

.aipg-crumbs {
    font-size: 14px;
    color: var(--color-text-muted, #6B7280);
    margin-bottom: var(--spacing-md, 16px);
}
.aipg-crumbs a {
    color: var(--color-link, #0ABAB5);
    text-decoration: none;
}
.aipg-crumbs a:hover { text-decoration: underline; }
.aipg-crumbs__sep { margin: 0 8px; opacity: .5; }

/* Заголовок термина с чипом буквы */
.aipg-term__title {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 2em;
    font-weight: 700;
    margin: 0 0 var(--spacing-sm, 8px);
    line-height: 1.2;
}

.aipg-term__letter-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 14px;
    background: var(--primary-gradient);
    color: #fff !important;
    border-radius: 12px;
    font-size: 20px;
    font-weight: 800;
    text-decoration: none !important;
    box-shadow: 0 4px 12px rgba(10, 186, 181, 0.3);
    transition: transform .15s, box-shadow .15s;
    line-height: 1;
}
.aipg-term__letter-chip:hover {
    transform: translateY(-2px) rotate(-3deg);
    box-shadow: 0 6px 18px rgba(10, 186, 181, 0.4);
}

.aipg-term__lead {
    font-size: 1.15em;
    color: var(--color-text-secondary, #4B5563);
    margin: 0 0 var(--spacing-lg, 24px);
    padding: var(--spacing-md, 16px) var(--spacing-lg, 24px);
    background: linear-gradient(135deg, #F0FDFA 0%, #FFFFFF 100%);
    border-left: 4px solid var(--color-primary-start, #0ABAB5);
    border-radius: 0 var(--radius-md, 12px) var(--radius-md, 12px) 0;
}

/* ============================================================
   Паспорт термина
   ============================================================ */
.aipg-term__passport {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin: 0 0 var(--spacing-lg, 24px);
    padding: 0;
    background: #FAFBFC;
    border: 1px solid #EEEEEE;
    border-radius: 12px;
    overflow: hidden;
}

.aipg-passport__row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid #EEEEEE;
    font-size: 14px;
    line-height: 1.5;
}
.aipg-passport__row:last-child {
    border-bottom: none;
}

.aipg-passport__label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 140px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.6px;
}
.aipg-passport__label svg {
    width: 14px;
    height: 14px;
    stroke: var(--color-primary-start, #0ABAB5);
    flex-shrink: 0;
}

.aipg-passport__value {
    flex: 1;
    color: var(--color-text-primary, #111);
    font-weight: 500;
    font-size: 14px;
}

.aipg-passport__chip {
    display: inline-block;
    padding: 3px 12px;
    margin: 0 4px 4px 0;
    background: #fff;
    border: 1px solid rgba(10, 186, 181, 0.35);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-primary-start, #0ABAB5);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s, transform .15s;
}
.aipg-passport__chip:hover {
    background: var(--primary-gradient);
    color: #fff !important;
    border-color: transparent;
    transform: translateY(-1px);
    text-decoration: none;
}

@media (max-width: 480px) {
    .aipg-passport__row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        padding: 12px 16px;
    }
    .aipg-passport__label {
        flex: none;
    }
}

/* ============================================================
   Контент
   ============================================================ */
.aipg-term__content {
    margin-bottom: var(--spacing-lg, 24px);
    font-size: 16px;
    line-height: 1.7;
}

/* ============================================================
   Источники
   ============================================================ */
.aipg-term__sources {
    margin-top: var(--spacing-xl, 32px);
    padding-top: var(--spacing-lg, 24px);
    border-top: 1px solid var(--color-border, #E5E7EB);
}

.aipg-term__sources-title {
    font-size: 1.1em;
    margin: 0 0 12px;
    color: var(--color-text-primary, #111);
}

.aipg-term__sources-body {
    padding: 16px 20px;
    background: var(--color-bg-light, #F7FAFC);
    border-radius: var(--radius-md, 12px);
    border-left: 4px solid var(--color-primary-start, #0ABAB5);
    font-size: 13px;
    line-height: 1.65;
    color: var(--color-text-secondary, #4B5563);
}

.aipg-term__sources-body p {
    margin: 0 0 8px;
}
.aipg-term__sources-body p:last-child {
    margin-bottom: 0;
}
.aipg-term__sources-body ul,
.aipg-term__sources-body ol {
    margin: 0;
    padding-left: 1.5em;
}
.aipg-term__sources-body li {
    margin-bottom: 4px;
}

/* ============================================================
   Связанные термины — карточки
   ============================================================ */
.aipg-term__related {
    margin-top: var(--spacing-xl, 32px);
    padding-top: var(--spacing-lg, 24px);
    border-top: 1px solid var(--color-border, #E5E7EB);
}

.aipg-term__related-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.2em;
    margin: 0 0 var(--spacing-md, 16px);
    color: var(--color-text-primary, #111);
}
.aipg-term__related-title svg {
    stroke: var(--color-primary-start, #0ABAB5);
    flex-shrink: 0;
}

.aipg-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
}

.aipg-related-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 16px 44px;
    background: #FFFFFF;
    border: 1px solid #EEEEEE;
    border-radius: 12px;
    text-decoration: none;
    color: var(--color-text-primary, #111);
    transition: transform .18s, box-shadow .18s, border-color .18s;
    overflow: hidden;
}
.aipg-related-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary-gradient);
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform .2s;
}
.aipg-related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(10, 186, 181, 0.12);
    border-color: rgba(10, 186, 181, 0.35);
    text-decoration: none;
}
.aipg-related-card:hover::before {
    transform: scaleY(1);
    transform-origin: top;
}

.aipg-related-card__arrow {
    position: absolute;
    left: 16px;
    top: 16px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary-start, #0ABAB5);
    font-size: 16px;
    font-weight: 700;
    transition: transform .2s;
}
.aipg-related-card:hover .aipg-related-card__arrow {
    transform: translateX(3px);
}

.aipg-related-card__title {
    font-weight: 700;
    font-size: 15px;
    line-height: 1.3;
    color: var(--color-text-primary, #111);
}

.aipg-related-card__def {
    font-size: 12.5px;
    line-height: 1.5;
    color: #6B7280;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Описание таксономии */
.aipg-tax-desc {
    font-size: 15px;
    color: var(--color-text-secondary, #4B5563);
    margin-bottom: var(--spacing-lg, 24px);
    line-height: 1.7;
}

/* ============================================================
   Sticky-навигация по буквам
   ============================================================ */
.aipg-single-sticky {
    display: flex;
    align-items: center;
    gap: 10px;
    position: sticky;
    top: 90px;
    z-index: 40;
    margin-bottom: var(--spacing-lg, 24px);
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0,0,0,.04));
}
.aipg-single-sticky__home {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--primary-gradient);
    color: #fff;
    text-decoration: none;
    transition: transform .15s, filter .15s;
}
.aipg-single-sticky__home:hover {
    transform: translateY(-1px);
    filter: brightness(1.08);
    color: #fff;
    text-decoration: none;
}
.aipg-single-sticky__letters {
    flex: 1;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
}
.aipg-single-sticky__letters::-webkit-scrollbar { height: 4px; }
.aipg-single-sticky__letters::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, .12);
    border-radius: 4px;
}
.aipg-single-sticky__letter {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text-primary, #111);
    text-decoration: none;
    background: transparent;
    transition: background .15s, color .15s;
}
.aipg-single-sticky__letter:hover {
    background: var(--primary-gradient);
    color: #fff;
    text-decoration: none;
}
.aipg-single-sticky__letter.is-current {
    background: var(--color-primary-start, #0ABAB5);
    color: #fff;
}
.aipg-single-sticky__letter.is-empty {
    opacity: .25;
    pointer-events: none;
}
@media (max-width: 768px) {
    .aipg-single-sticky { top: 70px; padding: 6px 8px; }
    .aipg-single-sticky__letter { padding: 2px 6px; font-size: 12px; }
}

/* ============================================================
   Tooltip на автолинковке
   ============================================================ */
a.aipg-autolink {
    position: relative;
    color: var(--color-link, #0ABAB5);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: color .15s, border-color .15s;
}
a.aipg-autolink:hover {
    color: var(--color-link-hover, #0A9D99);
    border-bottom-style: solid;
    text-decoration: none;
}

.aipg-autolink[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: #1f2937;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.4;
    white-space: normal;
    min-width: 200px;
    max-width: 320px;
    text-align: left;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s, visibility .18s, transform .18s;
    z-index: 9999;
    pointer-events: none;
    box-shadow: 0 12px 28px rgba(0,0,0,.18);
}
.aipg-autolink[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(2px);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    opacity: 0;
    visibility: hidden;
    transition: opacity .18s, visibility .18s;
    z-index: 9999;
    pointer-events: none;
}
.aipg-autolink[data-tooltip]:hover::after,
.aipg-autolink[data-tooltip].aipg-tooltip-open::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-8px);
}
.aipg-autolink[data-tooltip]:hover::before,
.aipg-autolink[data-tooltip].aipg-tooltip-open::before {
    opacity: 1;
    visibility: visible;
}

/* ============================================================
   Виджеты глоссария
   ============================================================ */

/* Fallback-обёртка: если виджет попал в чужой сайдбар */
.aipg-widget-card {
    background: var(--color-bg-primary, #FFFFFF);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0,0,0,.04));
    padding: var(--spacing-lg, 24px);
    margin-bottom: var(--spacing-lg, 24px);
    border: 1px solid var(--color-border, #E5E7EB);
}

/* Если виджет внутри нашего сайдбара .aipg-sidebar-section —
   обнуляем оформление, чтобы не было двойной карточки */
.aipg-sidebar-section .aipg-widget-card {
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
}

/* ------------------------------------------------------------
   Виджет «Термин дня»
   ------------------------------------------------------------ */
.aipg-widget-term {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0 8px;
}

.aipg-widget-term__title {
    display: inline-block;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--color-text-primary, #111);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color .15s, border-color .15s;
    align-self: flex-start;
}
.aipg-widget-term__title:hover {
    color: var(--color-primary-start, #0ABAB5);
    border-bottom-color: var(--color-primary-start, #0ABAB5);
    text-decoration: none;
}

/* Определение: симметричное скругление 8px, без левой полосы */
.aipg-widget-term__def {
    font-size: 13px;
    line-height: 1.6;
    color: var(--color-text-secondary, #4B5563);
    margin: 0;
    padding: 12px 14px;
    background: linear-gradient(135deg, #F0FDFA 0%, #FFFFFF 100%);
    border-radius: 8px;
}

/* Кнопка «Читать →» — прижата вправо */
.aipg-widget-term__more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--color-primary-start, #0ABAB5);
    text-decoration: none;
    align-self: flex-end;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(10, 186, 181, 0.08);
    transition: background .15s, color .15s, transform .15s;
}
.aipg-widget-term__more:hover {
    background: var(--primary-gradient);
    color: #fff;
    transform: translateX(2px);
    text-decoration: none;
}

/* ------------------------------------------------------------
   Виджет «Алфавит» — 5 букв в ряд
   ------------------------------------------------------------ */
.aipg-widget-alphabet {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 5px;
    padding: 4px 0;
}

.aipg-widget-alphabet__letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 32px;
    padding: 0 2px;
    border-radius: 8px;
    background: #F3F4F6;
    color: var(--color-text-primary, #111);
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
    transition: background .15s, color .15s, transform .15s, box-shadow .15s;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.aipg-widget-alphabet__letter:hover {
    background: var(--primary-gradient);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(10, 186, 181, 0.25);
    text-decoration: none;
}

.aipg-widget-alphabet__letter.is-empty {
    opacity: .3;
    pointer-events: none;
    background: transparent;
    border: 1px dashed #E5E7EB;
}

/* ============================================================
   Сайдбар плагина глоссария (.aipg-sidebar-section)
   Полная копия оформления .sidebar-ai-section темы
   ============================================================ */
.aipg-sidebar-section {
    background: var(--color-bg-primary, #FFFFFF);
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-card, 0 4px 12px rgba(0,0,0,.04));
    padding: var(--spacing-lg, 24px);
    margin-bottom: var(--spacing-lg, 24px);
    border: 1px solid var(--color-border, #E5E7EB);
}

.aipg-sidebar-section__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-text-primary, #111);
    margin-bottom: var(--spacing-md, 16px);
    padding-bottom: var(--spacing-sm, 8px);
    border-bottom: 2px solid var(--color-primary-start, #0ABAB5);
    display: inline-block;
}

/* Заглушка (когда сайдбар пуст и смотрит админ) */
.aipg-sidebar-section--empty {
    background: #FFFCF5;
    border-color: #FCD34D;
}
.aipg-sidebar-section--empty .aipg-sidebar-section__title {
    border-bottom-color: #F59E0B;
    color: #92400E;
}
.aipg-sidebar-section__hint {
    font-size: 13px;
    color: #78350F;
    margin: 0 0 8px;
    line-height: 1.5;
}
.aipg-sidebar-section__list {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    font-size: 13px;
    color: #78350F;
    line-height: 1.6;
}
.aipg-sidebar-section__link {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    color: #B45309;
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: color .15s;
}
.aipg-sidebar-section__link:hover {
    color: #92400E;
    text-decoration: none;
}

/* ============================================================
   Шорткоды
   ============================================================ */
.aipg-shortcode-list {
    list-style: none;
    margin: 1rem 0;
    padding: 0;
}
.aipg-shortcode-list__item {
    padding: 8px 0;
    border-bottom: 1px solid var(--color-border, #E5E7EB);
}
.aipg-shortcode-list__item:last-child { border-bottom: none; }
.aipg-shortcode-list__link {
    font-weight: 600;
    color: var(--color-text-primary, #111);
    text-decoration: none;
}
.aipg-shortcode-list__link:hover {
    color: var(--color-link, #0ABAB5);
    text-decoration: underline;
}
.aipg-shortcode-list__def {
    display: block;
    font-size: 13px;
    color: var(--color-text-muted, #6B7280);
    margin-top: 2px;
}

.aipg-term-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    background: var(--color-bg-light, #F7FAFC);
    border: 1px solid var(--color-border, #E5E7EB);
    border-radius: var(--radius-md, 12px);
    margin: 1rem 0;
}
.aipg-term-card__title {
    font-weight: 700;
    color: var(--color-text-primary, #111);
    text-decoration: none;
}
.aipg-term-card__title:hover {
    color: var(--color-link, #0ABAB5);
    text-decoration: underline;
}
.aipg-term-card__def {
    font-size: 13px;
    color: var(--color-text-muted, #6B7280);
}

/* ============================================================
   Адаптив
   ============================================================ */
@media (max-width: 768px) {
    .aipg-term { padding: var(--spacing-lg, 24px); }
    .aipg-term__title { font-size: 1.6em; }
    .aipg-term__letter-chip {
        min-width: 36px;
        height: 36px;
        padding: 0 10px;
        font-size: 17px;
        border-radius: 10px;
    }
    .aipg-letter { padding: 5px 10px; font-size: 13px; }

    .aipg-search {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding: 8px;
    }
    .aipg-search button {
        width: 100%;
        min-width: unset;
    }
    .aipg-search button svg { display: none; }

    .aipg-autolink[data-tooltip]::after {
        min-width: 180px;
        max-width: 260px;
    }
}

@media (max-width: 480px) {
    .aipg-related-grid {
        grid-template-columns: 1fr;
    }

    /* На узких экранах — 4 буквы в ряд для удобства нажатия */
    .aipg-widget-alphabet {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}