.site-search-page {
  --search-ink: #24313d;
  --search-muted: #6b7783;
  --search-line: #e3e8ec;
  --search-soft: #f5f7f8;
  --search-brand: #be0017;
  --search-brand-dark: #9a0013;
  --search-brand-soft: #fbeef0;
  --search-teal: #40a4aa;
  --search-teal-soft: #e8f5f5;
  background: #fff;
  color: var(--search-ink);
  min-height: 40vh;
  padding: 12px 16px 24px;
}
.site-search-page p::first-letter,
.site-search-page div::first-letter { color: inherit; font: inherit; padding: 0; }
.site-search-shell { margin: 0 auto; max-width: 860px; }
/* Полоса прокрутки всегда на месте: при смене вкладки ширина страницы не скачет */
html:has(.site-search-page) { overflow-y: scroll; }

/* Шапка и форма */
.site-search-hero h1 { color: var(--search-ink); font-size: clamp(20px, 3vw, 26px); font-weight: 700; line-height: 1.2; margin: 4px 0 2px; }
.site-search-lead { color: var(--search-muted); font-size: 15px; margin: 0 0 10px; }
.site-search-main-form { position: relative; }
.site-search-input-row { display: flex; gap: 8px; margin-right: 54px; }
.site-search-input-wrap { flex: 1; min-width: 0; position: relative; }
.site-search-input-icon { color: #98a3ad; left: 14px; pointer-events: none; position: absolute; top: 50%; transform: translateY(-50%); }
.site-search-input-wrap input { background: #fff; border: 1.5px solid #cfd8de; border-radius: 12px; color: var(--search-ink); font-size: 17px; height: 46px; outline: 0; padding: 0 14px 0 42px; width: 100%; }
.site-search-input-wrap input::placeholder { color: #9aa5ae; }
.site-search-input-wrap input:focus { border-color: var(--search-teal); box-shadow: 0 0 0 3px rgba(64, 164, 170, .18); }
.site-search-submit, .site-search-apply { background: var(--search-brand); border: 0; border-radius: 12px; color: #fff; cursor: pointer; font-weight: 600; transition: background-color .15s ease; }
.site-search-submit { font-size: 16px; height: 46px; padding: 0 22px; }
.site-search-apply { font-size: 14px; padding: 9px 20px; }
.site-search-submit:hover, .site-search-apply:hover { background: var(--search-brand-dark); }
.site-search-submit:focus-visible, .site-search-apply:focus-visible { outline: 3px solid rgba(190, 0, 23, .3); outline-offset: 2px; }
.site-search-form-error { color: var(--search-brand); font-size: 14px; margin: 8px 4px 0; }
.site-search-form-error ul { list-style: none; margin: 0; padding: 0; }

/* Фильтры */
.site-search-filters summary { align-items: center; background: #fff; border: 1.5px solid #cfd8de; border-radius: 12px; color: var(--search-muted); cursor: pointer; display: flex; height: 46px; justify-content: center; list-style: none; position: absolute; right: 0; top: 0; width: 46px; }
.site-search-filters summary::-webkit-details-marker { display: none; }
.site-search-filters summary:hover, .site-search-filters[open] summary { border-color: var(--search-teal); color: var(--search-ink); }
.site-search-filters[open] summary { background: var(--search-teal-soft); }
.site-search-filter-label { border: 0; clip: rect(0 0 0 0); height: 1px; overflow: hidden; position: absolute; white-space: nowrap; width: 1px; }
.site-search-filter-count { background: var(--search-brand); border: 2px solid #fff; border-radius: 999px; color: #fff; font-size: 11px; font-weight: 700; line-height: 1; padding: 3px 6px; position: absolute; right: -8px; top: -8px; }
.site-search-filter-grid { background: var(--search-soft); border-radius: 14px 14px 0 0; display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: 10px; padding: 14px 16px 6px; }
.site-search-filter-grid fieldset { border: 0; margin: 0; min-width: 0; padding: 0; }
.site-search-filter-grid legend { color: var(--search-ink); font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.site-search-filter-grid fieldset > div { display: flex; flex-direction: column; font-size: 14px; gap: 4px; }
.site-search-filter-grid #id_level { flex-flow: row wrap; gap: 4px 14px; }
.site-search-filter-grid label { align-items: flex-start; cursor: pointer; display: flex; gap: 7px; line-height: 1.35; margin: 0; }
.site-search-filter-grid input[type="checkbox"] { accent-color: var(--search-brand); flex: none; height: 16px; margin: 2px 0 0; width: 16px; }
.site-search-filter-grid select { border: 1px solid var(--search-line); border-radius: 10px; color: var(--search-ink); font-size: 14px; min-height: 150px; padding: 4px; width: 100%; }
.site-search-filter-actions { align-items: center; background: var(--search-soft); border-radius: 0 0 14px 14px; display: flex; gap: 18px; padding: 8px 16px 14px; }
.site-search-filter-actions a { color: var(--search-muted); font-size: 14px; text-decoration: underline; }
.site-search-filter-note { color: var(--search-muted); font-size: 13px; margin: 8px 4px 0; }
.site-search-filters .site-search-filter-note { background: var(--search-soft); margin: 0; padding: 2px 16px 0; }

/* Сводка и вкладки */
.site-search-results { margin-top: 10px; }
.site-search-summary { margin-bottom: 8px; }
.site-search-notice { background: #fff8e1; border-radius: 10px; color: #6b5300; font-size: 14px; margin: 0; padding: 8px 12px; }
.site-search-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.site-search-tabs a { background: #fff; border: 1px solid var(--search-line); border-radius: 999px; color: var(--search-ink); font-size: 14px; padding: 5px 11px; text-decoration: none; transition: border-color .15s ease, background-color .15s ease; }
.site-search-tabs a:hover { border-color: #c4ced5; text-decoration: none; }
.site-search-tabs a[aria-current="page"] { background: var(--search-brand-soft); border-color: rgba(190, 0, 23, .35); color: var(--search-brand); font-weight: 600; }
.site-search-tabs span { color: var(--search-muted); font-size: 12px; margin-left: 2px; }
.site-search-tabs a[aria-current="page"] span { color: inherit; opacity: .75; }

/* Группы */
.site-search-group { margin: 0 0 14px; }
.site-search-group-head { align-items: baseline; display: flex; gap: 12px; justify-content: space-between; margin-bottom: 6px; }
.site-search-group-head h2 { color: var(--search-ink); font-size: 16px; font-weight: 700; margin: 0; }
.site-search-group-head h2 span { color: var(--search-muted); font-size: 14px; font-weight: 400; margin-left: 4px; }
.site-search-group-head a { color: #1f6f74; font-size: 14px; font-weight: 500; white-space: nowrap; }
.site-search-group-head a:hover { color: var(--search-brand); }

/* Списки */
.site-search-result-list { display: grid; gap: 6px; list-style: none; margin: 0; padding: 0; }
.site-search-result-list--rows { background: #fff; border: 1px solid var(--search-line); border-radius: 12px; gap: 0; overflow: hidden; }

/* Компактная строка: слово, фраза, предложение, тема.
   Вся строка кликабельна через растянутую ссылку .site-search-row-main::after;
   слова фразы, кнопка «в словарь» и ссылка на урок лежат поверх неё. */
.site-search-row { align-items: center; display: flex; gap: 10px; padding: 8px 12px; position: relative; transition: background-color .15s ease; }
.site-search-row + .site-search-row { border-top: 1px solid var(--search-line); }
.site-search-row.has-link:hover { background: var(--search-soft); }
.site-search-row-text { display: flex; flex: 1; flex-direction: column; gap: 0; min-width: 0; }
.site-search-row-title { color: var(--search-ink); font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.site-search-row-main { color: var(--search-ink); text-decoration: none; }
/* Слово — словарная ссылка: бирюзовым; фраза и предложение — обычный текст, выделяется только совпадение */
.site-search-row:has([data-entity-type="word"]) .site-search-row-main { color: #1f6f74; }
.site-search-row:has([data-entity-type="phrase"]) .site-search-row-title, .site-search-row:has([data-entity-type="sentence"]) .site-search-row-title { font-weight: 500; line-height: 1.45; }
.site-search-row-main:hover { color: #1f6f74; text-decoration: underline; text-underline-offset: 2px; }
.site-search-row-main::after { content: ""; inset: 0; position: absolute; }
.site-search-row-main:focus-visible { outline: 0; }
.site-search-row-main:focus-visible::after { border-radius: 10px; outline: 2px solid var(--search-teal); outline-offset: -2px; }
.site-search-row.has-link:hover .site-search-row-title > .site-search-row-main { color: #1f6f74; }
.site-search-row-sub { color: var(--search-muted); font-size: 14px; overflow-wrap: anywhere; }
.site-search-row-meta { color: var(--search-muted); font-size: 12px; margin-top: 1px; }
.site-search-row-meta b { color: var(--search-ink); font-weight: 600; }
.site-search-token, .site-search-row-aside, .site-search-add, .site-search-in-dict, .site-search-row .site-search-chip { position: relative; z-index: 1; }
.site-search-token { border-bottom: 1px dashed #8fc3c6; color: inherit; text-decoration: none; }
.site-search-token:hover { border-bottom-color: #1f6f74; color: #1f6f74; text-decoration: none; }
.site-search-row-aside { color: var(--search-brand); }
.site-search-row-arrow, .site-search-row-open { color: #8fa0ab; flex: none; font-size: 22px; line-height: 1; text-decoration: none; }
.site-search-row-open:hover { color: var(--search-brand); text-decoration: none; }
.site-search-add { background: #fff; border: 1px solid var(--search-line); border-radius: 999px; color: var(--search-ink); cursor: pointer; flex: none; font-size: 12px; font-weight: 600; line-height: 1; padding: 6px 10px; text-decoration: none; white-space: nowrap; }
.site-search-add:hover { border-color: rgba(190, 0, 23, .35); color: var(--search-brand); text-decoration: none; }
.site-search-add:disabled { cursor: progress; opacity: .7; }
.site-search-in-dict { color: #2b7a7f; flex: none; font-size: 12px; font-weight: 600; white-space: nowrap; }
.site-search-page mark { background: #fff1b8; border-radius: 3px; color: inherit; padding: 0 1px; }

/* Панель вкладки и «Показать ещё» */
.site-search-panel:focus { outline: 0; }
.site-search-panel[aria-busy="true"] { opacity: .55; transition: opacity .15s ease; }
.site-search-panel-title { color: var(--search-ink); font-size: 16px; font-weight: 700; margin: 0 0 6px; }
.site-search-panel-title span { color: var(--search-muted); font-size: 14px; font-weight: 400; margin-left: 4px; }
.site-search-more-wrap { margin-top: 10px; text-align: center; }
.site-search-more { background: #fff; border: 1px solid var(--search-line); border-radius: 999px; color: var(--search-ink); display: inline-block; font-size: 14px; font-weight: 600; padding: 7px 18px; text-decoration: none; }
.site-search-more:hover { border-color: rgba(190, 0, 23, .35); color: var(--search-brand); text-decoration: none; }
.site-search-more[aria-busy="true"] { cursor: progress; opacity: .6; }

/* Карточка: урок, текст */
.site-search-card { background: #fff; border: 1px solid var(--search-line); border-radius: 12px; padding: 10px 12px; transition: border-color .15s ease, box-shadow .15s ease; }
.site-search-card:hover { border-color: #cdd6dc; box-shadow: 0 6px 20px rgba(36, 49, 61, .07); }
.site-search-card.is-locked { background: #fcfcfd; }
.site-search-card-meta { align-items: center; display: flex; flex-wrap: wrap; gap: 4px; }
.site-search-card-count { color: var(--search-muted); font-size: 12px; margin-left: auto; }
.site-search-card-title { font-size: 16px; font-weight: 700; line-height: 1.3; margin: 4px 0 0; }
.site-search-card-title a { color: var(--search-ink); text-decoration: none; }
.site-search-card-title a::after { content: ""; inset: 0; position: absolute; }
.site-search-card { position: relative; }
.site-search-card-title a:hover { color: var(--search-brand); }
.site-search-card-sub { color: var(--search-muted); font-size: 14px; }
.site-search-card-snippet { -webkit-box-orient: vertical; color: #4a5763; display: -webkit-box; font-size: 14px; -webkit-line-clamp: 2; line-clamp: 2; line-height: 1.5; margin-top: 2px; overflow: hidden; }

/* Окно закрытого урока (в стиле гостевого окна) */
.site-search-premium { border: 0; border-radius: 16px; box-shadow: 0 20px 50px rgba(30, 41, 59, .25); color: #1e293b; max-width: 400px; padding: 26px 24px 20px; text-align: center; width: calc(100% - 32px); }
.site-search-premium::backdrop { background: rgba(15, 23, 42, .45); }
.site-search-premium h2 { font-size: 19px; font-weight: 700; margin: 6px 0 4px; }
.site-search-premium-close { background: none; border: 0; color: #94a3b8; cursor: pointer; font-size: 24px; line-height: 1; position: absolute; right: 12px; top: 8px; }
.site-search-premium-close:hover { color: #475569; }
.site-search-premium-icon { font-size: 26px; }
.site-search-premium-lesson { color: #64748b; font-size: 14px; margin: 0 0 14px; }
.site-search-premium-lesson:empty { display: none; }
.site-search-premium-list { color: #334155; font-size: 14px; line-height: 1.45; list-style: none; margin: 0 0 18px; padding: 0; text-align: left; }
.site-search-premium-list li { padding-left: 24px; position: relative; }
.site-search-premium-list li + li { margin-top: 6px; }
.site-search-premium-list li::before { color: #16a34a; content: "✓"; font-weight: 700; left: 4px; position: absolute; }
.site-search-premium-cta { background: linear-gradient(135deg, #50C581, #40a4aa); border-radius: 10px; color: #fff; display: block; font-size: 16px; font-weight: 700; padding: 12px; text-decoration: none; }
.site-search-premium-cta:hover, .site-search-premium-cta:focus, .site-search-premium-cta:active { color: #fff; filter: brightness(.96); text-decoration: none; }
.site-search-premium-alt { color: var(--search-brand); display: inline-block; font-size: 14px; font-weight: 600; margin-top: 10px; }
.site-search-premium-login { color: #64748b; font-size: 13px; margin: 8px 0 0; }
.site-search-premium-login a { color: #2563eb; font-weight: 600; }

/* Метки */
.site-search-chip { background: var(--search-soft); border-radius: 999px; color: #56636e; font-size: 12px; font-weight: 600; line-height: 1; padding: 4px 8px; white-space: nowrap; }
.site-search-chip--level { background: var(--search-teal-soft); color: #2b7a7f; }
.site-search-chip--premium { background: #fff6dc; color: #8a6400; }

/* Пустое и нулевое состояния */
/* Быстрые ссылки на служебные страницы (подписка, оплата, пароль…) */
.site-search-shortcuts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin: 0 0 12px; }
.site-search-shortcut { background: var(--search-teal-soft); border: 1px solid #cfe7e8; border-radius: 12px; color: var(--search-ink); display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; text-decoration: none; transition: border-color .15s ease; }
.site-search-shortcut strong { color: #1f6f74; font-size: 15px; font-weight: 700; }
.site-search-shortcut span { color: var(--search-muted); font-size: 13px; line-height: 1.35; }
.site-search-shortcut:hover, .site-search-shortcut:focus { border-color: var(--search-teal); color: var(--search-ink); text-decoration: none; }
.site-search-state { background: var(--search-soft); border-radius: 14px; padding: 18px 16px; text-align: center; }
.site-search-state h2 { color: var(--search-ink); font-size: 18px; font-weight: 700; margin: 0 0 4px; }
.site-search-state p { color: var(--search-muted); font-size: 15px; line-height: 1.45; margin: 0 auto; max-width: 460px; }
.site-search-examples, .site-search-zero-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 12px; }
.site-search-examples a, .site-search-zero-links a { background: #fff; border: 1px solid var(--search-line); border-radius: 999px; color: var(--search-ink); font-size: 14px; padding: 7px 14px; text-decoration: none; transition: border-color .15s ease, color .15s ease; }
.site-search-examples a:hover, .site-search-zero-links a:hover { border-color: rgba(190, 0, 23, .35); color: var(--search-brand); text-decoration: none; }
.site-search-examples-label { color: var(--search-muted); font-size: 12px; font-weight: 600; letter-spacing: .02em; margin: 12px 0 0; }
.site-search-examples-label + .site-search-examples { margin-top: 6px; }
.site-search-zero-links a.is-primary { background: var(--search-brand); border-color: var(--search-brand); color: #fff; }
.site-search-zero-links a.is-primary:hover { background: var(--search-brand-dark); color: #fff; }

/* Пагинация */
.site-search-pagination { align-items: center; color: var(--search-muted); display: grid; font-size: 14px; grid-template-columns: 1fr auto 1fr; margin-top: 14px; text-align: center; }
.site-search-pagination a { border: 1px solid var(--search-line); border-radius: 999px; color: var(--search-ink); font-weight: 600; justify-self: start; padding: 7px 14px; text-decoration: none; }
.site-search-pagination a:hover { border-color: rgba(190, 0, 23, .35); color: var(--search-brand); }
.site-search-pagination a:last-child { justify-self: end; }

/* Поле поиска в шапке сайта */
.site-search-header { max-width: 330px; position: relative; width: min(28vw, 330px); z-index: 100; }
.site-search-header-form { display: flex; }
.site-search-header-form input { background: #fff; border: 1px solid #cfd8de; border-radius: 10px 0 0 10px; border-right: 0; color: #24313d; min-width: 0; padding: 7px 12px; width: 100%; }
.site-search-header-form input::placeholder { color: #9aa5ae; }
.site-search-header-form input:focus { border-color: #40a4aa; box-shadow: 0 0 0 3px rgba(64, 164, 170, .18); outline: 0; }
.site-search-header-form button { background: #fff; border: 1px solid #cfd8de; border-left: 0; border-radius: 0 10px 10px 0; color: #6b7783; cursor: pointer; display: flex; align-items: center; justify-content: center; min-width: 40px; transition: color .15s ease; }
.site-search-header-form button:hover { color: #be0017; }
.site-search-header-form input:focus + button { border-color: #40a4aa; }
.site-search-suggestions { background: #fff; border: 1px solid #e3e8ec; border-radius: 12px; box-shadow: 0 14px 34px rgba(36, 49, 61, .16); left: 0; max-height: min(430px, 70vh); overflow: auto; position: absolute; right: 0; top: calc(100% + 6px); }
.site-search-input-row { position: relative; }
.site-search-input-row > .site-search-suggestions { text-align: left; z-index: 30; }
.site-search-suggestion { border-bottom: 1px solid #eef1f3; color: #24313d; display: block; padding: 10px 14px; text-decoration: none; }
.site-search-suggestion:last-child { border-bottom: 0; }
.site-search-suggestion:hover, .site-search-suggestion.is-active { background: #f5f7f8; color: #be0017; text-decoration: none; }
.site-search-suggestion-title { -webkit-box-orient: vertical; display: -webkit-box; font-weight: 600; -webkit-line-clamp: 2; overflow: hidden; }
.site-search-suggestion-meta { color: #6b7783; display: block; font-size: 12px; margin-top: 2px; }
.site-search-suggestion-empty { color: #6b7783; padding: 12px 14px; }
.site-search-suggestion-all { background: #fafbfc; color: #be0017; font-size: 13px; font-weight: 600; }

@media (max-width: 767px) {
  .top-bar .right-block { gap: 8px; }
  .site-search-page { padding: 8px 12px 16px; }
  .site-search-hero h1 { margin-top: 4px; }
  .site-search-lead { font-size: 14px; margin-bottom: 8px; }
  .site-search-input-row { gap: 6px; margin-right: 50px; }
  .site-search-input-wrap input { font-size: 16px; height: 44px; padding-left: 36px; }
  .site-search-input-icon { left: 11px; }
  .site-search-submit { height: 44px; padding: 0 14px; }
  .site-search-filters summary { height: 44px; width: 44px; }
  .site-search-filter-grid { gap: 12px; grid-template-columns: 1fr; }
  .site-search-filter-grid fieldset > div { flex-flow: row wrap; gap: 4px 14px; }
  .site-search-filter-grid legend { margin-bottom: 4px; }
  .site-search-filter-grid select { max-height: 104px; min-height: 0; }
  .site-search-results { margin-top: 8px; }
  .site-search-tabs { flex-wrap: nowrap; margin: 0 -12px 10px; overflow-x: auto; padding: 0 12px 2px; scrollbar-width: none; }
  .site-search-tabs::-webkit-scrollbar { display: none; }
  .site-search-tabs a { flex: none; }
  .site-search-row { gap: 8px; padding: 8px 10px; }
  .site-search-card { padding: 10px; }
  .site-search-group-head h2 { font-size: 16px; }
  .site-search-filter-grid { padding: 12px 12px 4px; }
  .site-search-filter-actions { padding: 8px 12px 12px; }
  .site-search-pagination { gap: 6px; }
  .site-search-header { max-width: none; width: 100%; }
}

@media (max-width: 430px) {
  .top-bar .right-block { gap: 4px; }
  .site-search-filter-actions { align-items: flex-start; flex-direction: column; gap: 10px; }
  .site-search-row-arrow, .site-search-row-open span { display: none; }
  .site-search-add { padding: 6px 8px; }
}

/* Фраза и предложение на узком экране: текст на всю ширину, уровень и кнопка — строкой ниже */
@media (max-width: 576px) {
  .site-search-row:has([data-entity-type="phrase"]), .site-search-row:has([data-entity-type="sentence"]) { flex-wrap: wrap; row-gap: 6px; }
  .site-search-row:has([data-entity-type="phrase"]) .site-search-row-text, .site-search-row:has([data-entity-type="sentence"]) .site-search-row-text { flex-basis: 100%; }
  .site-search-row:has([data-entity-type="phrase"]) .site-search-row-arrow, .site-search-row:has([data-entity-type="sentence"]) .site-search-row-arrow,
  .site-search-row:has([data-entity-type="phrase"]) .site-search-row-open, .site-search-row:has([data-entity-type="sentence"]) .site-search-row-open { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .site-search-card, .site-search-row, .site-search-tabs a, .site-search-submit, .site-search-panel { transition: none; }
}
