:root {
  --bg: #FFFFFF;
  --text: #1B1F24;
  --muted: #57606A;
  --line: #E3E6EA;
  --chip: #F1F3F5;
  --accent: #1D5FD1;
  --accent-soft: #E8F0FD;
  --note-bg: #FFF8EC;
  --note-line: #F0DDB8;
  --ad-bg: #F6F7F9;
  --on-accent: #FFFFFF;
  color-scheme: light dark;
  --font: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1115;
    --text: #E6E8EB;
    --muted: #A0A7B1;
    --line: #2A2F37;
    --chip: #1A1E25;
    --accent: #6EA2FF;
    --accent-soft: #1B2A44;
    --note-bg: #2A2416;
    --note-line: #4A3D22;
    --ad-bg: #171A20;
    --on-accent: #0F1115;
  
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1115;
  --text: #E6E8EB;
  --muted: #A0A7B1;
  --line: #2A2F37;
  --chip: #1A1E25;
  --accent: #6EA2FF;
  --accent-soft: #1B2A44;
  --note-bg: #2A2416;
  --note-line: #4A3D22;
  --ad-bg: #171A20;
  --on-accent: #0F1115;

  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: break-word;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Header */
.site-header { border-bottom: 1px solid var(--line); background: var(--bg); }
.site-header__inner {
  max-width: 1100px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 18px; min-height: 44px; }
.logo:hover { text-decoration: none; }
.logo__mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 16px; font-weight: 700;
}
.search-form { display: flex; gap: 8px; flex: 1 1 280px; min-width: 0; }
.search-form__input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit; font-size: 16px;
}
.search-form__input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.search-form__btn {
  flex: 0 0 auto; min-height: 44px; padding: 0 20px; border: 0; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer;
}
.search-form__btn:hover { filter: brightness(1.08); }
.search-form--hero { margin-top: 20px; flex: none; }
.search-form--hero .search-form__input { min-height: 52px; font-size: 17px; }
.search-form--hero .search-form__btn { min-height: 52px; }

/* Layout */
.page { max-width: 1100px; margin: 0 auto; padding: 20px 16px 32px; }
.page__main { min-width: 0; }
.sidebar { margin-top: 24px; min-width: 0; }
@media (min-width: 1024px) {
  .page--with-sidebar { display: flex; align-items: flex-start; gap: 32px; }
  .page--with-sidebar .page__main { flex: 999 1 640px; }
  .page--with-sidebar .sidebar { flex: 0 0 300px; width: 300px; margin-top: 0; position: sticky; top: 16px; }
}

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip, .chips--links a {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: var(--chip); color: var(--text); font-size: 14px;
}
.chips--links a { color: var(--accent); }
.chips--links a:hover { background: var(--accent-soft); text-decoration: none; }
.chip--empty { color: var(--muted); }

/* Side boxes */
.side-box { border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 16px; }
.side-box:first-child { margin-top: 0; }
.side-box__title { font-size: 15px; font-weight: 600; margin-bottom: 12px; }

/* Word page */
.breadcrumbs { font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.word-head { margin-bottom: 16px; }
.word-head__title { font-size: 22px; font-weight: 700; }
.notice {
  margin-top: 12px; padding: 12px 16px; border-radius: 10px; font-size: 14px;
  background: var(--note-bg); border: 1px solid var(--note-line);
}
.answer { margin-top: 12px; font-size: 17px; }

.ad { display: block; margin: 16px 0; min-height: 250px; background: transparent; overflow: hidden; }
.ad-slot_a { min-height: 250px; }
.ad-slot_b { min-height: 250px; }
.ad-sidebar { min-height: 250px; margin-top: 0; }
@media (min-width: 1024px) {
  .ad-slot_a { min-height: 120px; }
  .ad-slot_b { min-height: 280px; }
  .ad-sidebar { min-height: 600px; }
}

.variant { border: 1px solid var(--line); border-radius: 12px; padding: 18px; margin-top: 16px; }
.variant__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.variant__num { font-size: 13px; color: var(--muted); }
.badge {
  display: inline-block; padding: 6px 12px; border-radius: 8px;
  background: var(--accent-soft); color: var(--accent); font-size: 14px; font-weight: 600;
}
.variant__grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
@media (min-width: 640px) { .variant__grid { grid-template-columns: 1fr 1fr; } }
.field + .field { margin-top: 14px; }
.variant__grid + .field { margin-top: 0; }
.field__label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field__value { font-size: 17px; font-weight: 500; }

/* Notebook */
.notebook {
  margin-top: 24px; padding: 16px; border-radius: 12px;
  background: var(--note-bg); border: 1px solid var(--note-line);
}
.notebook__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.notebook__title { font-size: 17px; font-weight: 600; }
.notebook__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.notebook__text { white-space: pre-wrap; font-size: 16px; line-height: 1.6; }
.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
}
.btn--outline { background: var(--bg); color: var(--accent); border: 1px solid var(--accent); }
.btn--outline:hover { background: var(--accent-soft); }

/* Forms tables */
.section-title { font-size: 19px; font-weight: 700; margin: 28px 0 14px; }
.forms { margin-top: 8px; }
.forms__block { margin-top: 16px; }
.forms__title { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: 12px; }
.forms-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.forms-table th, .forms-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.forms-table thead th { font-size: 13px; color: var(--muted); font-weight: 500; background: var(--chip); }
.forms-table tbody th { font-weight: 500; color: var(--muted); font-size: 14px; }
.forms-table tr:last-child th, .forms-table tr:last-child td { border-bottom: 0; }
.forms-table tr.is-current { background: var(--accent-soft); }
.forms-table tr.is-current td b { color: var(--accent); }

/* Examples and FAQ */
.examples__list { margin: 0; padding-left: 20px; }
.examples__list li + li { margin-top: 8px; }
.faq__item { border: 1px solid var(--line); border-radius: 10px; margin-top: 8px; padding: 0 16px; }
.faq__item summary { cursor: pointer; padding: 12px 0; min-height: 44px; font-weight: 500; }
.faq__item p { padding-bottom: 14px; color: var(--muted); }

/* Home, search, 404 */
.hero { padding: 16px 0 8px; }
.hero__title { font-size: 28px; font-weight: 700; }
@media (min-width: 640px) { .hero__title { font-size: 34px; } }
.lead { margin-top: 16px; color: var(--muted); font-size: 16px; }
.popular, .similar, .results { margin-top: 8px; }
.results__list { list-style: none; margin: 0; padding: 0; }
.results__list li { border-bottom: 1px solid var(--line); }
.results__list a { display: block; padding: 12px 0; min-height: 44px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 16px; }
.pager__prev, .pager__next { display: inline-block; padding: 10px 16px; border: 1px solid var(--line); border-radius: 10px; min-height: 44px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); }
.site-footer__inner {
  max-width: 1100px; margin: 0 auto; padding: 20px 16px;
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}

/* Print: only the notebook sample */
@media print {
  body.print-notebook > *:not(.page),
  body.print-notebook .site-header,
  body.print-notebook .sidebar { display: none !important; }
  body.print-notebook .page,
  body.print-notebook .page__main { display: block; padding: 0; max-width: none; }
  body.print-notebook .page__main > *:not(.notebook) { display: none !important; }
  body.print-notebook .notebook { border: 0; background: #fff; color: #000; margin: 0; padding: 0; }
  body.print-notebook .notebook__actions { display: none; }
  body.print-notebook .notebook__text { font-size: 16pt; color: #000; }
}

/* theme switcher: auto -> light -> dark */
.theme-toggle {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); cursor: pointer; padding: 0;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { display: none; }
:root:not([data-theme]) .theme-toggle .i-auto,
:root[data-theme="light"] .theme-toggle .i-light,
:root[data-theme="dark"] .theme-toggle .i-dark { display: block; }
@media (min-width: 768px) { .theme-toggle { order: 3; margin-left: 0; } }
@media print { .theme-toggle { display: none; } }

/* secondary readings, collapsed */
.variants-more { margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; padding: 0 16px; }
.variants-more > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--muted); font-weight: 600; }
.variants-more[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.variants-more .variant { border: 0; padding: 0 0 12px; }
.variants-more .variant + .variant { border-top: 1px dashed var(--line); padding-top: 12px; }
.variant__diff { margin: 8px 0 12px; font-weight: 600; color: var(--text); }
.chip--diff { background: var(--accent-soft); color: var(--accent); font-weight: 600; outline: 1px solid var(--accent); }

/* phrase search: one row per word */
.phrase { list-style: none; margin: 16px 0; padding: 0; border: 1px solid var(--line); border-radius: 14px; }
.phrase__item { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 16px; }
.phrase__item + .phrase__item { border-top: 1px solid var(--line); }
.phrase__word { font-size: 18px; font-weight: 600; min-width: 6em; }
.phrase__initial, .phrase__note { color: var(--muted); font-size: 15px; }

/* stress line on the word page */
.stress-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0 4px; font-size: 17px; }
.stress-line__label { color: var(--muted); }
.stress-line__word { font-size: 20px; }
.stress-line__syl { color: var(--muted); font-size: 15px; }
.stress-line__audio { height: 36px; max-width: 220px; }
.stress-line__link { font-weight: 600; }

/* phonetics page */
.phon { margin: 20px 0; }
.phon__tr { font-weight: 400; color: var(--muted); margin-left: 8px; }
.phon__facts { margin: 8px 0 12px; padding-left: 20px; }
.phon__table { width: 100%; border-collapse: collapse; font-size: 16px; }
.phon__table th, .phon__table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.phon__table th { background: var(--chip); font-weight: 600; }
.phon__letter { font-weight: 700; font-size: 18px; }
.phon__sound { font-weight: 600; white-space: nowrap; color: var(--accent); }
.phon__note { color: var(--muted); }
.notebook__text { white-space: pre-wrap; font: inherit; margin: 0; }
.phon__disclaimer { color: var(--muted); font-size: 14px; }

/* morpheme graphics, school notation */
.morph { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px; margin: 28px 0 20px; font-size: 34px; font-weight: 600; line-height: 1.2; }
.morph__part { position: relative; padding: 4px 3px 2px; min-width: 18px; text-align: center; }
.morph__part--prefix { border-top: 2px solid var(--accent); border-right: 2px solid var(--accent); }
.morph__part--root::before { content: ""; position: absolute; left: 0; right: 0; top: -10px; height: 14px; border-top: 2px solid var(--accent); border-radius: 50% 50% 0 0; }
.morph__part--suffix::before { content: ""; position: absolute; left: 50%; top: -9px; width: 14px; height: 14px; border-left: 2px solid var(--accent); border-top: 2px solid var(--accent); transform: translateX(-50%) rotate(45deg); }
.morph__part--ending { border: 2px solid var(--accent); margin-left: 2px; }
.morph__part--postfix { border-bottom: 2px dashed var(--accent); }
.related { margin: 20px 0; }
.phon__letter--stressed { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* hint shown right after the app is installed */
.install-tip { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 50; max-width: 560px; margin: 0 auto;
  padding: 16px; border-radius: 14px; background: var(--bg); color: var(--text); border: 2px solid var(--accent);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .25); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.install-tip p { margin: 0; flex: 1 1 260px; font-size: 16px; line-height: 1.45; }
.install-tip__close { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font: inherit; font-weight: 600; cursor: pointer; }

.syn-line { margin: 4px 0 8px; font-size: 17px; }

/* voice search */
.search-form__mic { flex: 0 0 auto; width: 48px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.search-form__mic:hover { border-color: var(--accent); color: var(--accent); }
.search-form__mic.is-listening { background: var(--accent); color: var(--on-accent); border-color: var(--accent); animation: mic-pulse 1s ease-in-out infinite; }
@keyframes mic-pulse { 50% { box-shadow: 0 0 0 6px var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .search-form__mic.is-listening { animation: none; } }

/* meanings */
.senses { margin: 16px 0; padding-left: 24px; }
.senses li { margin-bottom: 14px; }
.senses__gloss { margin: 0 0 4px; font-size: 18px; }
.senses__ex { margin: 2px 0 0; color: var(--muted); font-style: italic; }
