body {
    font-family: Arial, sans-serif;
    background: #f2f6fa;
    color: #333;
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    line-height: 120%;
}

.container {
    display: flex;
    max-width: 1000px;
    width: 100%;
    gap: 20px;
    flex-direction: row-reverse; /* Сайдбар справа */
}

.sidebar {
    flex: 0 0 220px; /* фиксированная ширина сайдбара */
    border-radius: 12px;
    padding: 15px;
    height: fit-content;
    box-shadow: 0 0 10px rgba(42, 110, 187, 0.1);
    position: sticky;
    top: 20px;
    background: #f8f8f8;
    border: 1px solid #ddd;
    max-width: 300px;
    padding-bottom: 12px;
}

.sidebar strong {
    display: block;
    font-size: 1.2em;
    margin-bottom: 12px;
    margin-top: 14px;
    color: #2a6ebb;
    font-weight: 700;
}

.sidebar a {
    display: block;
    margin: 6px 0;
    padding: 8px 14px;
    background: #d4e2ff;
    border-radius: 8px;
    font-size: 1em;
    text-decoration: none;
    transition: background 0.3s ease;
    white-space: nowrap;
    color: #333;
    margin-right: 6px;
}

.sidebar a:hover {
    background: #bcd4ff;
}

.sidebar a.selected {
    background: #2a6ebb;
    color: #fff;
    font-weight: 700;
}

main {
    flex: 1;
    background: #fff;
    border-radius: 12px;
    padding: 20px 30px;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    min-height: 600px;
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    font-size: 28px;
    color: #014f86;
}

form {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

input[type="text"] {
    flex: 1;
    min-width: 250px;
    padding: 10px;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
}

@media (max-width: 768px) {
  input[type="text"] {
    min-width: 180px;
  }
}

button {
    padding: 10px 20px;
    font-size: 16px;
    border-radius: 8px;
    border: none;
    background-color: #2a6ebb;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:hover {
    background-color: #1e4f99;
}

.exact-match {
    border: grey;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 6px 15px rgba(195, 195, 195, 0.3);
    color: #014f86;
    font-weight: 600;
    transition: box-shadow 0.3s ease;
}

.exact-match:hover {
    box-shadow: 0 4px 10px rgba(189, 189, 189, 0.5); /* тот же цвет, что в border */
}

.entry {
    background: #fff;
    border-radius: 10px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.entry h3 {
    margin: 0 0 5px;
}

.entry p {
    margin: 0;
    color: #555;
}

.entry a {
    color: #2a6ebb;
}

.entry a:hover {
    text-decoration: underline;
}

.pagination {
    margin: 30px 0;
    text-align: center;
}

.pagination a, 
.pagination span {
    display: inline-block;
    padding: 6px 12px;
    margin: 3px 3px;
    border-radius: 6px;
    text-decoration: none;
    background: #e6eefb;
    color: #2a6ebb;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
}

.pagination a:hover {
    background: #bcd4ff;
}

.pagination .current {
    background: #2a6ebb;
    color: #fff;
    cursor: default;
}

/* Адаптив */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        position: static;
        margin-bottom: 20px;
        max-width: 100%;
        max-height: 96px; /* Ограничиваем высоту, чтобы не занимала много места */
        padding: 0.5rem 0.5rem 0 0.5rem;
        border: none;
        background: #fff;
        box-shadow: none;
    }
    main {
        padding: 15px 20px;
    }
    .sidebar .scroll-y {
        max-height: 60px; /* такая же высота */
        overflow-x: auto;
        overflow-y: hidden;
        white-space: nowrap;
        padding-right: 0;
        padding-bottom: 10px; /* добавляем отступ снизу для смещения скролла */
        width: 100%;
    }
    .sidebar a {
        display: inline-block;
        padding: 0.4rem 1rem;
        margin-right: 0.5rem;
        border-radius: 20px;
        font-size: 0.9rem;
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        line-height: 1.2; /* чуть компактнее по высоте */
        white-space: nowrap;
    }
    .sidebar a:last-child {
        margin-right: 0;
    }
    .scroll-y {
        width: auto;
    }
}

/* Scroll-y контейнер */
.scroll-y {
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: thin;          /* для Firefox */
    scrollbar-color: grey;          /* оранжевая полоса + прозрачный трек */
    width: 224px;
}

/* Webkit */
.scroll-y::-webkit-scrollbar {
    width: 8px;  /* ширина полосы */
}

.scroll-y::-webkit-scrollbar-track {
    background: transparent; /* фон трека */
}

.mains {
    background: #fff;
    border-radius: 12px;
    padding: 20px 30px;
}

a {
    color: #2a6ebb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.letters-list a {
    margin: 0 5px;
    text-decoration: none;
    font-weight: bold;
    color: #000;
}
.letters-list a.selected {
    color: #2a6ebb;
}

#suggestions {
    position: absolute; 
    background: white; 
    border: 1px solid #ccc; 
    max-height: 144px; 
    overflow-y: auto;
    color: grey;
    width: 100%; 
    z-index: 1000;
    display: none;
    flex-direction: column;
    align-items: flex-start;
}

/* Кнопка */
#applyStyles {
    font-size: 24px; /* уменьшенный шрифт */
    border: none;
    color: grey;
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
}

#applyStyles:hover {
    background-color: rgb(216, 216, 216);
}

/* Крестик */
#closeBtn {
    font-size: 32px;
    color: rgba(27, 172, 104, 0.6);
    cursor: pointer;
    user-select: none;
    display: none; /* скрыт по умолчанию */
    transition: opacity 0.3s ease;
}

.mains {
	position: relative; /* Контейнер для абсолютного позиционирования */
}

.btn-container {
	position: absolute;
	top: -20px!important; /* отступ сверху */
	right: -8px!important; /* отступ справа */
	display: flex;
	gap: 8px; /* расстояние между ⋯ и × */
}

/* Скрыть кнопки на экранах больше 768px */
@media (min-width: 769px) {
    .btn-container {
        display: none;
    }
}

#applyStyles,
#closeBtn {
	cursor: pointer;
	line-height: 1;
	user-select: none;
}

.suggestion-item {
    text-align: left;
}

.scroll-y a {
    font-size: 14px;
}