/* Общие стили Prevod.ru: страница переводчика и «Что нового» */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dfe2e8;
  --text: #1b1f27;
  --muted: #626b7a;
  --accent: #2f5bd3;
  --accent-hover: #244bb5;
  --accent-soft: #e6ecfb;
  --warn: #b4540c;
  --warn-soft: #fdf1e6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 24, 33, .05), 0 4px 16px rgba(20, 24, 33, .04);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151b;
    --surface: #1a1e26;
    --surface-2: #222733;
    --border: #2e3442;
    --text: #e7eaf0;
    --muted: #9aa3b2;
    --accent: #7c9cff;
    --accent-hover: #98b1ff;
    --accent-soft: #232d4a;
    --warn: #f0a15e;
    --warn-soft: #3a2a1c;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151b;
  --surface: #1a1e26;
  --surface-2: #222733;
  --border: #2e3442;
  --text: #e7eaf0;
  --muted: #9aa3b2;
  --accent: #7c9cff;
  --accent-hover: #98b1ff;
  --accent-soft: #232d4a;
  --warn: #f0a15e;
  --warn-soft: #3a2a1c;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 32px 20px 48px; }

/* флаговая полоса сверху: синий · жёлтый · красный (белый — сам фон) */
.flagbar { height: 4px; background: linear-gradient(90deg, #002288 0 33.4%, #ffdd00 0 66.7%, #dd2233 0); }

header { margin-bottom: 28px; }
.topline { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.h1 { margin: 0; font-size: inherit; }
.logo { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.logo svg { width: 42px; height: 28px; border-radius: 5px; flex: none; box-shadow: 0 0 0 1px var(--border); }
.logo .name { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.logo .name .tld { color: var(--muted); font-weight: 500; }
.pun { margin: 0 0 4px; font-size: 15px; color: var(--muted); }
.pun b { color: var(--text); font-weight: 600; }
.pun .isv { color: var(--accent); font-weight: 600; font-style: normal; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.about-btn {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
}
.about-btn:hover { border-color: var(--accent); color: var(--accent); }
.news-btn, .back-btn {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
}
.news-btn:hover, .back-btn:hover { border-color: var(--accent); color: var(--accent); }
.news-btn:focus-visible, .back-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.donate-btn {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
}
.donate-btn:hover { border-color: #dd2233; color: #dd2233; }
.donate-btn:focus-visible, .about-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.about-btn__isv { color: var(--muted); }
.about-btn__isv::before { content: "·"; margin-right: 7px; color: var(--border); }

dialog.about {
  width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  color: var(--text); box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
}
dialog.about::backdrop { background: rgba(10, 12, 18, .55); }
.about__head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--surface);
}
.about__head h2 { margin: 0; font-size: 19px; }
.about__head h2 span { color: var(--muted); font-weight: 500; }
.about__close {
  width: 36px; height: 36px; border-radius: 9px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none;
}
.about__close:hover { border-color: var(--border); color: var(--text); }
.about__cols { display: grid; grid-template-columns: 1fr 1fr; }
.about__cols section { padding: 18px 22px 22px; font-size: 15px; line-height: 1.6; }
.about__cols section + section { border-left: 1px solid var(--border); background: var(--surface-2); }
.about__cols h3 {
  margin: 0 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted);
}
.about__cols p { margin: 0 0 12px; }
.about__cols a { color: var(--accent); }
.about__credit { color: var(--muted); font-size: 14px; margin-bottom: 0 !important; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center; flex: none;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .sun { display: none; }
.theme-toggle.is-dark .sun { display: block; }
.theme-toggle.is-dark .moon { display: none; }

/* ── панель языков ── */
.langbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.lang, .lang-dst { display: block; min-width: 0; }
.langbar select {
  appearance: none; -webkit-appearance: none; max-width: 100%;
  font: inherit; font-weight: 600; font-size: 15px; color: var(--text);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 32px 8px 12px; cursor: pointer;
}
.langbar select:hover { border-color: var(--accent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.lang.right { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.swap {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; display: grid; place-items: center;
  transition: transform .2s, border-color .15s;
}
.swap:hover { border-color: var(--accent); color: var(--accent); }
.swap:active { transform: rotate(180deg); }
.swap:focus-visible, button:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}

.seg { display: inline-flex; background: var(--surface-2); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px;
  padding: 4px 10px; border-radius: 7px; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); font-weight: 600; }
.seg[hidden] { display: none; }

/* ── панели текста ── */
.panes { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pane {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 260px;
}
.pane.out { background: var(--surface-2); }
textarea, .output {
  flex: 1; width: 100%; border: 0; resize: none; background: transparent; color: var(--text);
  font: inherit; font-size: 19px; line-height: 1.55; padding: 18px 20px 8px; min-height: 200px;
}
textarea:focus { outline: none; }
.pane:focus-within { border-color: var(--accent); }
.output { white-space: pre-wrap; overflow-wrap: anywhere; }
.output.placeholder { color: var(--muted); }
.output.busy { opacity: .55; transition: opacity .2s .15s; }
.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 12px 10px 20px; color: var(--muted); font-size: 13px; min-height: 48px;
}
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 14px; padding: 7px 12px; border-radius: 9px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn[disabled] { opacity: .5; cursor: default; }
.btn.icon { padding: 7px 9px; }
.btn .i-done { display: none; color: #1a8f4c; }
.btn.done .i-done { display: block; }
.btn.done .i-copy { display: none; }
.actions { display: flex; gap: 6px; }

.examples { margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.examples span { color: var(--muted); font-size: 13px; margin-right: 2px; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; padding: 4px 10px; border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

.error {
  margin-top: 12px; padding: 10px 14px; border-radius: 10px;
  background: var(--warn-soft); color: var(--warn); font-size: 14px;
}

/* ── разбор ── */
details.analysis {
  margin-top: 24px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
details.analysis summary {
  cursor: pointer; padding: 14px 20px; font-weight: 600; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
details.analysis summary::-webkit-details-marker { display: none; }
details.analysis summary small { font-weight: 400; color: var(--muted); }
details.analysis summary .chev { transition: transform .2s; color: var(--muted); }
details[open].analysis summary .chev { transform: rotate(180deg); }
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.word { font-weight: 600; white-space: nowrap; }
td.form { color: var(--accent); font-weight: 600; white-space: nowrap; }
.tag {
  display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); margin: 1px 3px 1px 0; white-space: nowrap;
}
.tag.pos { background: var(--accent-soft); color: var(--accent); }
tr.unknown td.word::after { content: " ?"; color: var(--warn); }
tr.unknown td { background: var(--warn-soft); }
.note { color: var(--muted); font-size: 13px; }
.empty-analysis { padding: 16px 20px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--border); }

footer {
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border);
  color: var(--muted); font-size: 13px; display: grid; gap: 6px;
}
footer p { margin: 0; }
footer a { color: inherit; }
footer .brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
.footer-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
footer .footer-top .brand { margin-bottom: 0; }
.footer-credit { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; color: var(--muted); }
.footer-credit:hover { color: var(--text); }
/* логотип белый PNG — используем его как маску, чтобы он был цвета текста в обеих темах */
.footer-credit__logo {
  display: inline-block; height: 1.3em; aspect-ratio: 323 / 100; background: currentColor;
  -webkit-mask: url(/static/mtlab-logo.png) center / contain no-repeat;
          mask: url(/static/mtlab-logo.png) center / contain no-repeat;
}
footer .build { font-size: 12px; font-variant-numeric: tabular-nums; }
footer .build code { font: inherit; }
footer .brand svg { width: 21px; height: 14px; border-radius: 2px; box-shadow: 0 0 0 1px var(--border); }

/* на узких экранах подписи прячем визуально, но оставляем для скринридеров */
@media (max-width: 560px) {
  .donate-btn__label, .about-btn__ru, .news-btn__label, .back-btn__label {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .donate-btn, .about-btn, .news-btn, .back-btn { padding: 0 9px; height: 36px; }
  .theme-toggle { width: 36px; height: 36px; }
  .logo .name { font-size: 23px; }
  .logo svg { width: 36px; height: 24px; }
  .top-actions { gap: 6px; }
}
@media (max-width: 760px) {
  .about-btn__isv { display: none; }
  .about__cols { grid-template-columns: 1fr; }
  .about__cols section + section { border-left: 0; border-top: 1px solid var(--border); }
  .wrap { padding: 20px 16px 36px; }
  h1 { font-size: 22px; }
  .panes { grid-template-columns: 1fr; }
  .langbar { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); row-gap: 10px; }
  .lang.right { display: contents; }
  .langbar { column-gap: 8px; }
  .lang-dst { justify-self: stretch; }
  .langbar select { width: 100%; font-size: 13.5px; padding: 7px 22px 7px 9px; background-position: right 7px center; }
  .swap { width: 36px; height: 36px; }
  #scriptSeg { grid-column: 1 / -1; justify-self: end; }
  textarea, .output { font-size: 17px; min-height: 140px; }
  .pane { min-height: 190px; }
}

/* ── «Что нового» ── */
.page-title { font-size: 22px; margin: 0 0 6px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.page-head .page-title { margin: 0; }
.lead a, .current a { color: var(--accent); }
.current {
  margin: 20px 0 8px; padding: 12px 16px; border-radius: var(--radius);
  background: var(--accent-soft); color: var(--text); font-size: 15px;
}
.current code, .update code { font-size: 13px; }
.updates { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 12px; }
.update {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px; scroll-margin-top: 16px;
}
.update.is-current { border-color: var(--accent); }
.update__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.update__title { margin: 8px 0 4px; font-size: 17px; line-height: 1.35; }
.update__title a { color: var(--text); text-decoration: none; }
.update__title a:hover { color: var(--accent); text-decoration: underline; }
.update__text { margin: 0; color: var(--muted); font-size: 15px; }
.badge {
  display: inline-block; font-size: 12px; line-height: 1.6; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.badge.ver { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.badge.ver.soft { font-family: inherit; color: var(--muted); }
.badge.now { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.badge.ok { color: #1a8f4c; border-color: currentColor; }
.badge.soon { color: var(--warn); border-color: currentColor; }

/* ── форма «Исправить перевод» ── */
dialog.report { width: min(560px, calc(100vw - 32px)); }
.report__body { padding: 14px 20px 18px; display: grid; gap: 6px; }
.report__hint { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.report__hint a { color: var(--accent); }
.report__label { font-size: 13px; font-weight: 600; margin-top: 6px; padding-left: 11px; }
.report__label span { font-weight: 400; color: var(--muted); }
.report__body textarea, .report__body input[type="text"] {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; resize: vertical;
  min-height: 0; height: auto; font-size: 15px; flex: none;
}
.report__body input[type="text"] { resize: none; }
.report__body textarea:focus, .report__body input[type="text"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.report__check { display: flex; align-items: center; gap: 8px; margin-top: 10px; padding-left: 11px; font-size: 14px; cursor: pointer; }
.report__check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.report__credit { display: grid; gap: 6px; }
.report__credit[hidden] { display: none; }
.report__actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.report__status { color: var(--muted); font-size: 14px; }

/* ── страница корректоров ── */
.correctors { margin: 0 0 10px; padding-left: 20px; columns: 2 220px; }
.correctors li { margin: 2px 0; }
.correctors__empty { margin-top: 0; }
.correctors__empty span { color: var(--muted); }
