.gl-wrap,
.gl-term-wrap {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 24px 20px 72px;
    box-sizing: border-box;
}

.gl-hero {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(34px, 6vw, 68px) clamp(20px, 5vw, 58px) 32px;
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    background:
        radial-gradient(circle at 16% 18%, rgba(122, 77, 245, 0.3), transparent 38%),
        radial-gradient(circle at 84% 72%, rgba(56, 232, 197, 0.2), transparent 40%),
        var(--fx-bg-elevated);
    box-shadow: var(--fx-shadow-md);
    text-align: center;
}

.gl-hero::after {
    content: '';
    position: absolute;
    z-index: -1;
    inset: 0;
    background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.035), transparent 80%);
    pointer-events: none;
}

.gl-hero-kicker {
    margin-bottom: 12px;
    color: var(--fx-ac2);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.5px;
}

.gl-hero-title {
    max-width: 760px;
    margin: 0 auto 14px;
    color: var(--fx-text-main);
    font-size: clamp(28px, 5vw, 48px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -1.2px;
    text-wrap: balance;
}

.gl-hero-sub {
    max-width: 700px;
    margin: 0 auto;
    color: var(--fx-text-muted);
    font-size: 15px;
    line-height: 1.65;
    text-wrap: balance;
}

.gl-search-wrap {
    max-width: 680px;
    margin: 28px auto 0;
}

.gl-search {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 58px;
    padding: 0 18px;
    border: 1px solid var(--fx-border-strong);
    border-radius: 18px;
    background: rgba(5, 5, 9, 0.68);
    box-shadow: 0 14px 40px rgba(0, 0, 0, 0.25);
    transition: var(--fx-transition);
}

.gl-search:focus-within {
    border-color: var(--fx-ac1);
    box-shadow: 0 0 0 3px rgba(122, 77, 245, 0.14), 0 18px 48px rgba(0, 0, 0, 0.3);
}

.gl-search svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    fill: var(--fx-text-dim);
}

.gl-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--fx-text-main);
    font: inherit;
    font-size: 16px;
}

.gl-search input::placeholder { color: var(--fx-text-dim); }
.gl-search input::-webkit-search-cancel-button { filter: invert(1); opacity: 0.55; }

.gl-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 22px;
    margin-top: 22px;
    color: var(--fx-text-dim);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.45px;
}

.gl-stats span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gl-stats span::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--fx-ac2);
    box-shadow: 0 0 8px rgba(56, 232, 197, 0.7);
}

.gl-stats strong { color: var(--fx-text-main); }

.gl-alphabet-scroll {
    position: static;
    z-index: 8;
    top: 8px;
    margin: 22px 0 14px;
    padding: 0;
    overflow: visible;
    border: 0;
    background: none;
    scrollbar-width: none;
}

.gl-alphabet-scroll::-webkit-scrollbar { display: none; }

.gl-alphabet {
    display: flex;
    gap: 6px;
    width: max-content;
    min-width: 100%;
}

.gl-letter {
    min-width: 42px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--fx-text-muted);
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: var(--fx-transition);
}

.gl-letter:hover {
    border-color: var(--fx-border-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--fx-text-main);
}

.gl-letter.active {
    border-color: rgba(122, 77, 245, 0.55);
    background: linear-gradient(135deg, rgba(122, 77, 245, 0.28), rgba(56, 232, 197, 0.12));
    color: #fff;
    box-shadow: inset 0 0 18px rgba(122, 77, 245, 0.12);
}

.gl-result-meta {
    min-height: 22px;
    margin: 0 2px 12px;
    color: var(--fx-text-dim);
    font-size: 12px;
}

.gl-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
}

.gl-card {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 230px;
    flex-direction: column;
    padding: 22px;
    overflow: hidden;
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    background: var(--fx-bg-elevated);
    background-image: linear-gradient(155deg, rgba(255, 255, 255, 0.035), transparent 45%);
    box-shadow: var(--fx-shadow-sm);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gl-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto;
    height: 2px;
    background: linear-gradient(90deg, var(--fx-ac1), var(--fx-ac2));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gl-card:hover {
    transform: translateY(-3px);
    border-color: var(--fx-border-strong);
    box-shadow: var(--fx-shadow-md);
}

.gl-card:hover::before { opacity: 1; }

.gl-term-header {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.gl-term-title {
    min-width: 0;
    margin: 0;
    font-size: 20px;
    font-weight: 850;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.gl-term-title a {
    color: var(--fx-text-main);
    text-decoration: none;
}

.gl-term-title a:hover { color: var(--fx-ac2); }

.badge-cat,
.gl-term-category {
    display: inline-flex;
    max-width: 48%;
    flex: 0 0 auto;
    padding: 5px 9px;
    overflow: hidden;
    border: 1px solid rgba(122, 77, 245, 0.25);
    border-radius: 999px;
    background: rgba(122, 77, 245, 0.1);
    color: #a990ff;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: 0.45px;
    line-height: 1.3;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.gl-def-text {
    display: -webkit-box;
    flex: 1;
    margin-bottom: 20px;
    overflow: hidden;
    color: var(--fx-text-muted);
    font-size: 14px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 5;
}

.highlight {
    padding: 0 2px;
    border-radius: 3px;
    background: rgba(56, 232, 197, 0.18);
    color: var(--fx-ac2);
}

.gl-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: auto;
}

.gl-details-link,
.gl-tool-link,
.gl-primary-link,
.gl-back-link {
    display: inline-flex;
    min-height: 40px;
    align-items: center;
    justify-content: center;
    padding: 9px 13px;
    border: 1px solid var(--fx-border);
    border-radius: 11px;
    color: var(--fx-text-main);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
    transition: var(--fx-transition);
}

.gl-details-link { flex: 1; }
.gl-tool-link { color: var(--fx-ac2); }

.gl-details-link:hover,
.gl-back-link:hover {
    border-color: var(--fx-ac1);
    background: rgba(122, 77, 245, 0.1);
}

.gl-tool-link:hover {
    border-color: var(--fx-ac2);
    background: rgba(56, 232, 197, 0.09);
}

.gl-primary-link {
    border-color: transparent;
    background: linear-gradient(135deg, var(--fx-ac1), var(--fx-ac2));
    color: #08080c;
}

.gl-primary-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(56, 232, 197, 0.2);
}

.gl-empty {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 8px;
    color: var(--fx-text-muted);
    text-align: center;
}

.gl-empty[hidden] { display: none; }
.gl-empty strong { color: var(--fx-text-main); }
.gl-empty span { font-size: 13px; }
.gl-empty-icon { color: var(--fx-ac1); font-size: 48px; line-height: 1; }
.gl-empty--static { min-height: 180px; }

.gl-more {
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px dashed var(--fx-border);
    border-radius: var(--fx-radius-md);
    color: var(--fx-text-dim);
    font-size: 12px;
    text-align: center;
}

/* Страница отдельного термина */
.gl-term-wrap { max-width: 920px; }

.gl-breadcrumbs {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    margin: 4px 0 18px;
    overflow: hidden;
    color: var(--fx-text-dim);
    font-size: 12px;
    white-space: nowrap;
}

.gl-breadcrumbs a { color: var(--fx-text-muted); text-decoration: none; }
.gl-breadcrumbs a:hover { color: var(--fx-ac2); }
.gl-breadcrumbs [aria-current="page"] { overflow: hidden; text-overflow: ellipsis; }

.gl-term-article,
.gl-not-found {
    overflow: hidden;
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    background: var(--fx-bg-elevated);
    box-shadow: var(--fx-shadow-md);
}

.gl-term-hero {
    position: relative;
    padding: clamp(30px, 6vw, 58px);
    overflow: hidden;
    border-bottom: 1px solid var(--fx-border);
    background:
        radial-gradient(circle at 12% 12%, rgba(122, 77, 245, 0.28), transparent 42%),
        radial-gradient(circle at 88% 88%, rgba(56, 232, 197, 0.16), transparent 38%),
        rgba(0, 0, 0, 0.16);
}

.gl-term-hero h2 {
    max-width: 780px;
    margin: 15px 0 8px;
    color: var(--fx-text-main);
    font-size: clamp(32px, 7vw, 58px);
    font-weight: 900;
    line-height: 1.06;
    letter-spacing: -1.4px;
    overflow-wrap: anywhere;
}

.gl-term-hero p { margin: 0; color: var(--fx-text-muted); font-size: 14px; }
.gl-term-category { max-width: 100%; }

.gl-definition {
    padding: clamp(24px, 5vw, 48px);
    color: var(--fx-text-main);
    font-size: clamp(16px, 2vw, 18px);
    line-height: 1.85;
    overflow-wrap: anywhere;
}

.gl-term-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px clamp(24px, 5vw, 48px);
    border-top: 1px solid var(--fx-border);
    background: rgba(0, 0, 0, 0.14);
}

.gl-not-found {
    padding: clamp(38px, 8vw, 80px) 24px;
    text-align: center;
}

.gl-not-found-code {
    color: var(--fx-ac1);
    font-size: clamp(54px, 12vw, 92px);
    font-weight: 900;
    line-height: 1;
    opacity: 0.75;
}

.gl-not-found h2 { margin: 14px 0 8px; color: var(--fx-text-main); }
.gl-not-found p { max-width: 560px; margin: 0 auto 24px; color: var(--fx-text-muted); line-height: 1.6; }

@media (prefers-reduced-motion: no-preference) {
    .gl-card { animation: glCardIn 0.32s ease both; }
    @keyframes glCardIn {
        from { opacity: 0; transform: translateY(8px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

@media (max-width: 640px) {
    .gl-wrap,
    .gl-term-wrap { padding: 14px 14px 52px; }
    .gl-hero { padding: 34px 16px 24px; }
    .gl-hero-title { letter-spacing: -0.7px; }
    .gl-search { min-height: 54px; padding: 0 14px; }
    .gl-stats { display: grid; gap: 7px; justify-content: start; text-align: left; }
    .gl-alphabet-scroll { top: 6px; margin-top: 14px; }
    .gl-letter { min-width: 40px; }
    .gl-grid { grid-template-columns: 1fr; }
    .gl-card { min-height: 0; padding: 18px; }
    .gl-term-actions { align-items: stretch; flex-direction: column; }
    .gl-term-actions a { width: 100%; box-sizing: border-box; }
    .gl-definition { line-height: 1.72; }
}
