/* ===== Malayalam English Dictionary — единый файл стилей ===== */
:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #6b7280;
  --accent: #0e7c66;
  --accent-2: #0a5c4c;
  --border: #e5e7eb;
  --chip: #eef6f3;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141c;
    --card: #1a2030;
    --text: #e7eaf2;
    --muted: #9aa3b5;
    --accent: #34c9a3;
    --accent-2: #6fe0c3;
    --border: #2a3245;
    --chip: #21304a;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.mal { font-family: "Noto Sans Malayalam", -apple-system, sans-serif; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Шапка */
.site-header { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
.header-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.logo { font-weight: 700; font-size: 18px; color: var(--text); white-space: nowrap; }
.logo span { color: var(--accent); }
.logo .logo-mal { color: var(--accent); margin-right: 4px; }
.searchbox { position: relative; flex: 1 1 260px; display: flex; }
.searchbox input {
  flex: 1; padding: 10px 14px; font-size: 16px;
  border: 1px solid var(--border); border-right: none;
  border-radius: 8px 0 0 8px; background: var(--bg); color: var(--text); outline: none;
}
.searchbox input:focus { border-color: var(--accent); }
.searchbox button {
  padding: 10px 18px; border: none; border-radius: 0 8px 8px 0;
  background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.searchbox button:hover { background: var(--accent-2); }
.suggest {
  position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12); overflow: hidden; z-index: 100;
}
.suggest a { display: block; padding: 8px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.suggest a:last-child { border-bottom: none; }
.suggest a:hover { background: var(--chip); text-decoration: none; }
.suggest a span { display: block; font-size: 13px; color: var(--muted); }
.topnav { display: flex; gap: 14px; font-size: 14px; }
.topnav a { color: var(--muted); font-weight: 600; }
.topnav a:hover { color: var(--accent); }

main { padding: 20px 16px 40px; }

/* Контент */
.hero { text-align: center; padding: 24px 0 8px; }
.hero h1 { font-size: 30px; margin: 0 0 8px; }
.lead { color: var(--muted); }
h1 { font-size: 26px; line-height: 1.3; }
.muted { color: var(--muted); font-weight: 400; }
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 20px; margin: 16px 0;
}
.card h2 { margin-top: 0; font-size: 19px; }
.prose p { margin: 10px 0; }

.crumbs { font-size: 13px; color: var(--muted); margin: 4px 0 10px; }
.crumbs a { color: var(--muted); }

/* Страница слова */
.entry h1 { margin: 0 0 4px; font-size: 32px; }
.entry .tr { color: var(--muted); font-size: 22px; font-weight: 400; }
.pos-line { color: var(--muted); font-size: 14px; margin-top: 0; }
.meanings { padding-left: 22px; font-size: 18px; }
.meanings li { margin: 6px 0; }
.rel-en { font-size: 14px; color: var(--muted); }
.pos-badge {
  display: inline-block; padding: 1px 9px; border-radius: 20px;
  background: var(--chip); color: var(--accent); font-weight: 700; font-size: 13px;
  text-transform: capitalize;
}
.examples { display: grid; gap: 10px; }
.example { border-left: 3px solid var(--accent); background: var(--chip); border-radius: 0 8px 8px 0; padding: 10px 14px; }
.example p { margin: 2px 0; }
.ex-ml { font-size: 17px; font-weight: 600; }
.ex-tr { color: var(--muted); font-style: italic; font-size: 14px; }
.ex-en { font-size: 15px; }

/* Списки слов */
.word-list { list-style: none; padding: 0; margin: 0; }
.word-list li { padding: 9px 0; border-bottom: 1px solid var(--border); }
.word-list li:last-child { border-bottom: none; }
.word-list .mal { font-weight: 600; }
.word-list .tr { color: var(--muted); font-size: 14px; }

/* Буквы */
.letter-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.letter-chip {
  display: flex; flex-direction: column; align-items: center; min-width: 54px;
  padding: 8px 10px; background: var(--chip); border-radius: 8px; color: var(--text);
}
.letter-chip .mal { font-size: 20px; font-weight: 700; color: var(--accent); }
.letter-chip small { color: var(--muted); font-size: 11px; }
.letter-chip:hover { text-decoration: none; outline: 2px solid var(--accent); }
.letter-grid.big .letter-chip { min-width: 72px; }

.az { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.az a { padding: 5px 11px; background: var(--chip); border-radius: 6px; font-weight: 700; }
.az a.on { background: var(--accent); color: #fff; }
.token-cols { columns: 3; list-style: none; padding: 0; }
.token-cols li { padding: 3px 0; break-inside: avoid; }
@media (max-width: 600px) { .token-cols { columns: 2; } }

/* Тематические страницы */
.topic-table-wrap { overflow-x: auto; }
.topic-table { width: 100%; border-collapse: collapse; }
.topic-table th { text-align: left; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--border); }
.topic-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); }
.topic-table tr:last-child td { border-bottom: none; }
.topic-table td.mal { font-weight: 600; font-size: 17px; }
.topic-table .tr-cell { color: var(--muted); font-style: italic; }
.topic-links { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.topic-links li a { display: inline-block; padding: 7px 13px; background: var(--chip); border-radius: 20px; font-weight: 600; font-size: 14px; }
.topic-links li a:hover { text-decoration: none; outline: 2px solid var(--accent); }
.topic-links.big { flex-direction: column; gap: 4px; }
.topic-links.big li a { background: none; padding: 6px 0; font-size: 16px; border-radius: 0; }
.topic-links.big li a:hover { outline: none; text-decoration: underline; }

.pager { display: flex; justify-content: center; gap: 18px; align-items: center; margin: 18px 0; }
.pager a { padding: 8px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; font-weight: 600; }

/* Слово дня */
.wod-word a { font-size: 24px; }
.wod-word .tr { color: var(--muted); font-size: 17px; }
.wod-def { font-size: 17px; }

/* Реклама */
.ad-slot { max-width: 960px; margin: 12px auto 0; padding: 0 16px; text-align: center; }
.ad-slot:empty { display: none; }

/* Подвал */
.site-footer { border-top: 1px solid var(--border); background: var(--card); padding: 20px 0; margin-top: 30px; font-size: 14px; color: var(--muted); }
.foot-links { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }

@media (max-width: 720px) {
  .header-inner { gap: 8px; }
  .logo { font-size: 16px; }
  .topnav { width: 100%; justify-content: space-between; }
  .searchbox { order: 3; flex-basis: 100%; }
  .hero h1 { font-size: 24px; }
  .entry h1 { font-size: 26px; }
}
