/* === Сброс и базовые настройки === */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    /* Цвета */
    --color-bg: #ffffff;
    --color-text: #2d3748;
    --color-text-light: #4a5568;
    --color-accent: #4f46e5;
    --color-accent-hover: #4338ca;
    --color-warning-bg: #fef2f2;
    --color-warning-text: #b91c1c;
    --color-card-bg: #fef3c7;
    --color-footer-bg: #1a202c;
    --color-footer-text: #a0aec0;
    --color-border: #e2e8f0;
    --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
    --transition: all 0.2s ease;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    height: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: min(95%, 1200px);
    margin-inline: auto;
}
main.container {
    flex: 1;
}
.adv2{
	display:flex;
	justify-content:center;
	align-items:center;
	max-width:320px;
	margin:10px auto 30px;
}
.adv2>div{
	min-width:160px!important;
}

/* === Дополнительные вспомогательные стили === */
ul.st3 {
    display: flex;
    flex-wrap: wrap;
}
ul.st3 li {
    list-style: none;
    border: 1px solid #ccc;
    padding: 8px 15px;
    margin-right: 15px;
    margin-bottom: 20px;
    box-shadow: 1px 1px 10px 4px #ccc;
}
.adv1{
    margin: 10px 0;
}
.table_wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* плавная прокрутка на iOS */
}

/* Убедитесь, что таблица не сжимается некорректно */
.table_wrap table {
    min-width: 100%;
    border-collapse: collapse;
}

/* Опционально: улучшить читаемость на мобилках */
.tdfirst {
    white-space: nowrap;
}
.pagination_wrap {
    display: flex;
    width: 100%;
    justify-content: center;
}



/* Сбрасываем стили Bootstrap для пагинации */
.pagination {
    display: flex;
    padding-left: 0;
    margin: 20px 0;
    border-radius: 4px;
}

.pagination .page-item {
    display: list-item;
    text-align: -webkit-match-parent;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination .page-item a,
.pagination .page-item span {
    position: relative;
    float: none;
    padding: 5px 10px;
    margin-left: 0;
    line-height: 1.42857143;
    color: #333;
    text-decoration: none;
    background-color: transparent;
    border: none;
    border-radius: 0;
}

.pagination .page-item.active a {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
    cursor: default;
}

/* Если хотите, чтобы активная страница была выделена цветом */
.pagination .page-item.active a {
    background-color: #6f42c1;
    color: white;
    border-radius: 4px;
}

.pagination {
    margin-bottom: 20px;
    padding: 0;
}
.pagination .page-item.prev,
.pagination .page-item.next {
    display: inline-block;
    margin: 0 5px;
}

.pagination .page-item.prev a,
.pagination .page-item.next a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f8f9fa;
    color: #6c757d;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s ease;
    margin-top: -4px;
}

/* Ховер-эффект */
.pagination .page-item.prev:hover a,
.pagination .page-item.next:hover a {
    background-color: #6f42c1;
    color: #fff;
}

/* Активный/неактивный стиль */
.pagination .page-item.disabled span {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/*---------------------------------------------------------*/
/* === Двухколоночный макет: контент + сайдбар === */
.page-layout {
    display: flex;
    gap: 32px;
}

.main-content {
    flex: 1;
    min-width: 0;
}

.sidebar {
    width: 300px;
    flex-shrink: 0;
}

.sidebar-card {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

.sidebar-card h3 {
    font-size: 1.125rem;
    margin-bottom: 0;
    margin-top: -5px;
    color: var(--color-text);
}

.sidebar-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-links li {
    margin-bottom: 8px;
}

.sidebar-links a {
    color: var(--color-accent);
    text-decoration: none;
}

.sidebar-links a:hover {
    text-decoration: underline;
}

.ad-placeholder {
    background-color: #f7fafc;
    border: 1px dashed #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 250px;
    color: #718096;
    font-size: 0.875rem;
}

/*---------------------------------------------------------*/
.queries-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    list-style: none;
    padding: 0;
    margin: 0;
}
.queries-grid.stgr {
    margin-bottom: 40px;
}
.queries-grid li {
    background: #f8f9fa;
    padding: 12px;
    border-radius: var(--radius);
    text-align: center;
    transition: background 0.2s, transform 0.1s;
    border: 1px solid var(--color-border);
}

.queries-grid a {
    color: var(--color-accent);
    font-weight: 600;
    text-decoration: none;
    display: block;
}

.queries-grid a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}
.trs{
    font-size: 50px;
    font-weight: bold;
    color: var(--color-accent);
}
.m_razb svg{
    width: 15em!important;
    fill: red!important;
}

/* Адаптивность */
@media (max-width: 768px) {
    .queries-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .queries-grid {
        grid-template-columns: 1fr;
    }
}

/* === Адаптивность: на мобильных сайдбар уходит вниз === */
@media (max-width: 992px) {
    .page-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        order: -1;
        display: flex;
        flex-direction: column;
    }
.main-content{
    order: 2;
}
.advsidebar{
    order: -2;
}
.polezn{
    display: none;
}
    .ad-placeholder {
        height: 200px;
    }
}

@media (max-width: 768px) {
    .pagination .page-item {
        display: inline-block;
        margin-right: 5px;
    }
}

img, svg {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    border: none;
    background: none;
    cursor: pointer;
}

ol, ul {
    padding-left: 20px;
}

/* === Header === */
.header {
    background: var(--color-bg);
    padding-block: 12px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.logo {
    font-size: clamp(1.25rem, 4vw, 1.5rem);
    font-weight: 800;
    color: var(--color-accent);
}

.search-bar {
    flex: 1;
    max-width: 500px;
    display: flex;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    font-size: 1rem;
    outline: none;
}

.search-bar button {
    background: var(--color-accent);
    color: white;
    padding: 0 20px;
    font-weight: 600;
}
/*=================*/
.sidebar-card .search-bar {
    flex: 1;
    max-width: 500px;
    display: flex;
    flex-direction: column;          /* ← основное изменение */
    gap: 8px;                        /* ← отступ между input и button */
    background: white;
    border-radius: 0;
    box-shadow: none;
    padding: 12px;                   /* ← добавляем padding, чтобы не прилипало к краям */
}

.sidebar-card .search-bar input {
    width: 100%;                     /* ← растягиваем input на всю ширину */
    padding: 12px 16px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 1rem;
    outline: none;
}

.sidebar-card .search-bar button {
    width: 100%;                     /* ← кнопка во всю ширину */
    padding: 12px;
    background: var(--color-accent);
    color: white;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease;
}
.a_btn {
    width: 100%;                     /* ← кнопка во всю ширину */
    padding: 12px;
    background: var(--color-accent);
    color: white;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease;
}

.sidebar-card .search-bar button:hover {
    background: var(--color-accent-hover);
}
/*===========*/
.user-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.social-icons {
    display: flex;
    gap: 12px;
}

.social-icons a {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f7fafc;
    color: var(--color-text);
    font-size: 14px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #cbd5e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
}

/* === Main Content === */
main {
    padding-block: 32px;
}

.intro {
    background: var(--color-card-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid #ffcc66;
}
.morfdesc {
    margin: 24px 0;
    padding: 16px;
    background-color: #f0f9ff;
    border-radius: var(--radius);
    border-left: 4px solid #3182ce;
}

.napisanie_wrap {
    margin: 24px 0;
    padding: 16px;
    background-color: #ffebeb;
    border-radius: var(--radius);
    border-left: 4px solid red;
}

.intro h1 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
    margin-bottom: 12px;
    color: var(--color-text);
}

.intro p {
    margin-bottom: 12px;
    color: var(--color-text-light);
}

.root-tag {
    display: inline-block;
    background: #e0e7ff;
    color: var(--color-accent);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 8px;
}

.tip {
    background: #dbeafe;
    padding: 12px;
    border-radius: var(--radius);
    margin-top: 16px;
    font-size: 0.9rem;
}

.results-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-md);
}

.word-info h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    color: var(--color-text);
}

.word-info p {
    color: var(--color-text-light);
    margin-bottom: 16px;
}

.word-list ol {
    list-style-type: decimal;
    font-size: 1.125rem;
}

.word-list li {
    margin-bottom: 10px;
}

.word-list a {
    color: var(--color-accent);
    transition: var(--transition);
}

.word-list a:hover {
    color: var(--color-accent-hover);
    text-decoration: underline;
}

/* === Homonyms === */
.homonym-section {
    background: var(--color-warning-bg);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: var(--shadow-sm);
}

.homonym-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--color-warning-text);
}

.warning-box {
    background: white;
    padding: 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    border-left: 4px solid var(--color-warning-text);
}

.homonym-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.card {
    background: white;
    padding: 12px 16px;
    border-radius: 20px;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.badge {
    background: var(--color-warning-text);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.tip-box {
    background: #fffbeb;
    padding: 16px;
    border-radius: var(--radius);
    border-left: 4px solid #ca8a04;
}

/* === Footer === */
.footer {
    background: var(--color-footer-bg);
    color: var(--color-footer-text);
    padding-block: 40px;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 32px;
    margin-bottom: 32px;
}

.brand img {
    height: 28px;
    margin-bottom: 12px;
}

.brand p {
    font-size: 0.9rem;
    line-height: 1.5;
}

.links h4,
.social-share h4 {
    color: white;
    margin-bottom: 16px;
    font-size: 1.125rem;
}

.links ul {
    list-style: none;
    padding: 0;
}

.links li {
    margin-bottom: 10px;
}

.links a:hover {
    text-decoration: underline;
}

.icons {
    display: flex;
    gap: 16px;
}

.icons a {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.copyright {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid #2d3748;
    font-size: 0.875rem;
}

/* === Стили для справочной статьи (вторая страница) === */
.top_span, .root_span {
    text-transform: uppercase;
    font-weight: bold;
}
.top_span {
    color: var(--color-accent);
}
.entry-title{
    text-align: center;
}
.entry-title .top_span {
    display: block;
    text-align: center;
    font-weight: bold;
}
.etsa{
    color: var(--color-accent);
    font-size: 22px;
}
.root_span {
    color: red;
}

main:not(.container) {
    padding-inline: clamp(1rem, 5vw, 2rem);
    padding-block: 2rem;
    max-width: 1200px;
    margin-inline: auto;
}

.entry-title {
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 800;
    margin-bottom: 1.5rem;
    color: var(--color-text);
    line-height: 1.2;
}

.entry-image {
    margin-bottom: 2rem;
    text-align: center;
}

.entry-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.content {
    line-height: 1.7;
    color: var(--color-text-light);
    font-size: clamp(1rem, 2.5vw, 1.125rem);
}

.content h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
    margin: 2.5rem 0 1.25rem;
    color: var(--color-text);
    font-weight: 700;
}

.content p {
    margin-bottom: 1.25rem;
}

.content ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.content ul li {
    margin-bottom: 0.5rem;
    position: relative;
}

.content p:not(:last-child) {
    margin-bottom: 1.25rem;
}

/* === Стили для новой страницы (фонетика, морфемы, ударения и пр.) === */

/* Таблица фонетического разбора */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
}

.tdfirst {
    font-weight: bold;
    color: #1a202c;
    background-color: #f7fafc;
    padding: 8px 12px;
    text-align: center;
    border: 1px solid var(--color-border);
}

table td,
table th {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    vertical-align: top;
}

table tr:nth-child(even) {
    background-color: #f8fafc;
}

.itog {
    font-weight: bold;
    margin-top: 16px;
    color: var(--color-text);
}

/* Цветовая схема звуков */
.schema {
    font-family: monospace;
    font-size: 1.5rem;
    letter-spacing: 2px;
    margin: 16px 0;
}

.rsb {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
}

.rsb_blue { background-color: #c3dafe; color: #2b6cb0; }
.rsb_red  { background-color: #fed7d7; color: #c53030; }
.rsb_green  { background-color: #c6f6d5; color: #276749; }

/* Ударения и окраска */
.stress {
    position: relative;
}

.stress::after {
    content: "́";
    position: absolute;
    top: -0.4em;
    left: 0;
    font-size: 0.8em;
    color: red;
}

.red,
.napisanie .red {
    color: #e53e3e;
    font-weight: bold;
}

.napisanie {
    font-size: 1.75rem;
    font-family: monospace;
    margin: 16px 0;
    letter-spacing: 2px;
}

.subnapisanie {
    font-size: 1.1rem;
    color: var(--color-text-light);
    margin-top: -8px;
    margin-bottom: 20px;
}

/* Переносы */
.perenos p {
    font-size: 1.5rem;
    margin: 16px 0;
}

.hyph {
    color: #3182ce;
    font-weight: bold;
}

/* Морфемный разбор */



.comp-s {
    font-weight: bold;
    margin-bottom: 8px;
    color: var(--color-text);
}

.comp-c {
    line-height: 1.6;
}

.cmrf {
    font-weight: 600;
    color: #4a5568;
}

.cmrfn {
    color: var(--color-accent);
    font-weight: bold;
}

/* Блоки с атрибутами, синонимами и т.д. */
.block_item {
    display: inline-block;
    background: #e2e8f0;
    color: #2d3748;
    padding: 6px 12px;
    margin: 4px 8px 4px 0;
    border-radius: 20px;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.block_item:hover {
    background: var(--color-accent);
    color: white;
    cursor: pointer;
}

/* Предложения с примерами */
.predl {
    font-style: italic;
    color: var(--color-text-light);
    margin-top: 4px;
    font-size: 0.95rem;
    border-left: 3px solid #cbd5e0;
    padding-left: 12px;
}

/* Таблица склонения (заменяет Bootstrap-стили) */
.table {
    width: 100%;
    margin: 24px 0;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.table th,
.table td {
    padding: 10px;
    border: 1px solid var(--color-border);
    text-align: center;
}

.table th {
    background-color: #edf2f7;
    font-weight: bold;
    color: var(--color-text);
}

.table tfoot td {
    font-weight: bold;
}

/* === Адаптивность === */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar {
        order: -1;
        margin-bottom: 16px;
    }

    .user-actions {
        justify-content: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .icons {
        justify-content: center;
    }

    /* Адаптив для таблиц */
    .results-card, .homonym-section {
        overflow-x: auto;
    }
    table { min-width: 600px; }
}

@media (max-width: 480px) {
    .intro,
    .results-card,
    .homonym-section {
        padding: 16px;
    }

    .word-info h2 {
        font-size: 1.75rem;
    }

    .search-bar input {
        padding: 10px;
    }

    .search-bar button {
        padding: 0 16px;
        font-size: 0.9rem;
    }

    .napisanie { font-size: 1.5rem; }
    .schema { font-size: 1.25rem; }
}
