/* Lisons — интерфейс: спокойный «французский элегантный» стиль из макетов */
:root {
  --bg: #F5F4F0; --paper: #FFFFFF; --ink: #1B2230; --muted: #5F6878; --line: #E2DFD8; --soft: #ECEAE4;
  --accent: #1F3A68; --accent-ink: #FFFFFF; --danger: #8A3B2E; --ok: #1E6B45;
  --liaison: #3A4552; --stroke: #10151F; --fl-l: 46%;
  --display: "Cormorant Garamond", Georgia, serif;
  --ui: "Jost", "Helvetica Neue", Arial, sans-serif;
  --text: "Gentium Book Plus", "Charis SIL", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); }
a:hover { color: #142847; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding: 14px 24px; background: var(--paper); border-bottom: 1px solid var(--line); }
.top .left { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.logo { text-decoration: none; color: var(--ink); font-family: var(--display); font-size: 30px; font-weight: 600; line-height: 1; }
.logo .on { position: relative; display: inline-block; color: var(--accent); }
.logo .on::before { content: "~"; position: absolute; left: 50%; top: -.2em; transform: translateX(-50%); font-size: .66em; line-height: 1; }
.nav { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.nav a { text-decoration: none; color: var(--ink); padding: 9px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 8px; }
.nav a[aria-current="page"] { background: var(--soft); }
.nav a.outline { color: var(--accent); border: 1px solid var(--accent); padding: 8px 16px; }
.account { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); flex-wrap: wrap; }
.account form { margin: 0; }

/* Кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); border-radius: 999px; padding: 10px 18px; font-size: 15px; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { background: #142847; }
.btn.link { border: 0; background: none; color: var(--accent); padding: 6px 8px; min-height: auto; text-decoration: underline; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.danger { color: var(--danger); border-color: #E2CFC9; }

/* Рабочая панель */
.work { display: grid; grid-template-columns: 280px minmax(0, 1fr) 300px; gap: 20px; padding: 20px 24px 48px; align-items: start; max-width: 1500px; margin: 0 auto; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 20px; min-width: 0; }
.lbl { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; margin: 0 0 10px; }
.settings { display: grid; gap: 22px; }
.seg { display: flex; border: 1px solid #D9D5CC; border-radius: 999px; padding: 3px; }
.seg button { flex: 1; border: 0; border-radius: 999px; padding: 8px 6px; background: transparent; cursor: pointer; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.hint { margin: 8px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.frow { display: grid; grid-template-columns: 20px minmax(52px, max-content) minmax(0, 1fr); align-items: center; gap: 10px; padding: 6px 2px; font-size: 15px; cursor: pointer; }
.frow input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.frow .sample { font-family: var(--text); font-size: 18px; white-space: nowrap; text-align: center; }
details.more .frow .sample { text-align: left; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; padding: 6px 2px; }
details.more .frow { font-size: 14px; padding-left: 14px; }
details.more h4 { margin: 12px 0 2px; font-size: 13px; font-weight: 600; }

.sheet { display: grid; gap: 18px; padding: 28px clamp(18px, 4vw, 48px); }
.titlein { font-family: var(--display); font-size: 34px; font-weight: 600; border: 0; border-bottom: 1px solid transparent; padding: 2px 0; width: 100%; background: transparent; }
.titlein:hover, .titlein:focus { border-bottom-color: var(--line); outline: none; }
textarea.src { width: 100%; min-height: 150px; resize: vertical; font-family: var(--text); font-size: 18px; line-height: 1.55; padding: 12px 14px; border: 1px solid var(--line); border-radius: 6px; background: #FBFAF7; }
.row { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.count { font-size: 14px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.count.over { color: var(--danger); font-weight: 600; }
.msg { margin: 0; font-size: 15px; padding: 12px 16px; border-radius: 6px; background: #E8EEF6; color: var(--accent); }
.msg.err { background: #F6E9E6; color: var(--danger); }
.msg[hidden] { display: none; }
.placeholder { color: var(--muted); font-size: 15px; margin: 0; }

/* Размеченный текст */
.txt { font-family: var(--text); font-size: 27px; line-height: 2.35; color: var(--ink); overflow-wrap: break-word; max-width: 36em; }
.txt .w { cursor: pointer; border-radius: 3px; }
.txt .w:hover { box-shadow: 0 0 0 1px var(--line); }
.txt .w.sel { box-shadow: 0 0 0 2px var(--accent); }
.txt.on-silent .silent, .ghost { color: var(--paper); -webkit-text-stroke: 1px var(--stroke); paint-order: stroke fill; }
.txt.on-careful .careful { font-weight: 700; }
.txt .lia-gap, .txt .lia-no { position: relative; display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.txt.on-liaison .lia-gap:not(.opt)[data-sound]::before, .txt.on-liaison-opt .lia-gap.opt[data-sound]::before { content: attr(data-sound); position: absolute; left: calc((var(--la, -.62em) + var(--lw, 1em) / 2) / .52); top: .98em; transform: translateX(-50%); font-size: .52em; line-height: 1; font-weight: 700; color: var(--liaison); white-space: nowrap; pointer-events: none; font-family: var(--ui); }
.txt.on-liaison .lia-gap:not(.opt)::after, .txt.on-liaison-opt .lia-gap.opt::after { content: ""; position: absolute; left: var(--la, -.62em); width: var(--lw, 1em); top: .1em; height: .3em; border: 2px solid var(--liaison); border-top: 0; border-radius: 0 0 1em 1em / 0 0 .8em .8em; pointer-events: none; }
.txt.on-liaison-opt .lia-gap.opt::after { border-style: dashed; border-width: 1.5px; border-top: 0; }
.txt.on-liaison-opt .lia-gap.opt[data-sound]::before { font-weight: 400; }
.txt.on-liaison-no .lia-no::after { content: ""; position: absolute; left: -.2em; top: -.78em; height: 1em; border-left: 2px solid var(--liaison); pointer-events: none; }
.txt.on-ecaduc-cl .caduc-cl, .txt.on-ecaduc .caduc { color: var(--paper); -webkit-text-stroke: 1px var(--stroke); paint-order: stroke fill; }
.txt .exc-mark { display: none; }
.txt.on-exceptions .exc-mark { display: inline; font-family: var(--ui); font-size: .55em; font-weight: 600; margin-left: .05em; -webkit-text-stroke: 0; }
.txt.on-enchainement .ench-from { position: relative; }
.txt.on-enchainement .ench-from::after { content: ""; position: absolute; left: var(--ea, 50%); top: calc(100% - .14em); width: var(--ew, calc(.7em + var(--tail) * .46em)); height: .2em; border: 1.2px solid var(--liaison); border-top: 0; border-radius: 0 0 1em 1em / 0 0 .8em .8em; opacity: .75; pointer-events: none; }

/* Легенда */
.legend { border-top: 1px solid var(--line); padding-top: 18px; display: grid; gap: 10px; }
.legend.at-top { border-top: 0; padding-top: 0; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.legend ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 24px; }
.legend li { display: grid; grid-template-columns: minmax(64px, max-content) minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 14px; line-height: 1.4; }
.legend .lg-s { font-family: var(--text); font-size: 19px; white-space: nowrap; }
.legend .lg-ipa { font-family: var(--text); }
.legend .lg-ex { font-family: var(--text); font-style: italic; color: var(--muted); }
.legend .lg-en { color: var(--muted); }
.legend .exc-list { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.legend .exc-list li { grid-template-columns: minmax(0, 1fr); }
.legend .exc-w { font-family: var(--text); font-weight: 700; font-size: 17px; }

/* Карточка слова */
.wordcard .big { font-family: var(--text); font-size: 34px; line-height: 1.9; padding-bottom: 10px; }
.facts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; font-size: 15px; line-height: 1.45; }
.facts li { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 10px; }
.facts .k { font-family: var(--text); font-size: 18px; text-align: center; }
.ipa { font-family: var(--text); font-size: 18px; color: var(--muted); margin: 0 0 12px; }
form.report { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
form.report textarea { min-height: 70px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; }
form.report select { padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }

/* Списки и формы */
.page { max-width: 1080px; margin: 0 auto; padding: 44px 24px 64px; display: grid; gap: 24px; }
.page h1 { margin: 0; font-family: var(--display); font-size: 46px; font-weight: 600; line-height: 1.05; }
.sub { margin: 4px 0 0; color: var(--muted); }
.tlist { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; }
.tlist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 16px 22px; border-bottom: 1px solid #ECE9E2; }
.tlist li:last-child { border-bottom: 0; }
.tlist a.t { text-decoration: none; color: var(--ink); display: grid; gap: 2px; min-width: 0; }
.tlist .tt { font-size: 18px; font-weight: 500; }
.tlist .ts { font-family: var(--text); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tlist .meta { font-size: 14px; color: var(--muted); white-space: nowrap; }
.empty { padding: 28px 22px; color: var(--muted); margin: 0; }

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 40px 16px 64px; gap: 24px; }
.auth .logo { font-size: 38px; }
.auth main { width: 100%; max-width: 440px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; padding: 32px; display: grid; gap: 18px; }
.auth h1 { margin: 0; font-family: var(--display); font-size: 34px; font-weight: 600; }
.fld { display: grid; gap: 6px; font-size: 14px; color: #3B4456; }
.fld input { font-size: 16px; padding: 12px 14px; border: 1px solid #D9D5CC; border-radius: 6px; background: var(--paper); }
.roles { display: flex; gap: 10px; }
.roles label { flex: 1; display: flex; gap: 10px; align-items: center; padding: 12px 14px; border: 1px solid #D9D5CC; border-radius: 6px; cursor: pointer; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: #3B4456; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.note { font-size: 13px; color: var(--muted); text-align: center; max-width: 440px; margin: 0; }
footer.foot { max-width: 1500px; margin: 0 auto; padding: 0 24px 32px; font-size: 13px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
footer.foot a { color: var(--muted); }

/* Карточка слова всегда на виду: на широком экране «прилипает» к верху окна при прокрутке,
   на узком — выезжает панелью снизу, когда выбрано слово */
.wc-head { display: flex; align-items: center; justify-content: space-between; }
.wc-head .lbl { margin: 0; }
.wc-close { display: none; width: 44px; height: 44px; margin: -10px -10px -10px 0; border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--ink); cursor: pointer; }
@media (min-width: 1151px) {
  .wordcol { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
}
@media (max-width: 1150px) {
  .work { grid-template-columns: 250px minmax(0, 1fr); }
  .wordcol { display: none; }
  .wordcol.open { display: block; position: fixed; left: 12px; right: 12px; bottom: 12px; z-index: 50; max-height: 55vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(27, 34, 48, .22); max-width: 560px; margin: 0 auto; }
  .wc-close { display: block; }
  body.wc-open .work { padding-bottom: 60vh; }  /* можно докрутить текст выше панели */
}
@media (max-width: 780px) {
  .work { grid-template-columns: minmax(0, 1fr); padding: 12px 12px 40px; }
  .sheet { order: 1; } .setcol { order: 2; }
  .txt { font-size: 22px; }
  .tlist li { grid-template-columns: minmax(0, 1fr) auto; }
  .tlist .meta.size { display: none; }
  .top { padding: 12px 14px; }
}

/* Дуга-образец в легенде, фильтрах и карточке слова — того же вида, что в тексте */
.arc { display: inline-block; width: .8em; height: .34em; margin: 0 .02em; vertical-align: -.1em; overflow: visible; }
.nw { white-space: nowrap; }
.ctx { color: #A3A9B3; -webkit-text-stroke: 0; }

/* Mon compte */
.account .acc-link { color: var(--ink); text-decoration: none; }
.account .acc-link:hover, .account .acc-link[aria-current] { text-decoration: underline; }
.account-page { max-width: 720px; margin: 24px auto 48px; padding: 28px 32px; display: grid; gap: 28px; }
.account-page h1 { margin: 0; font-family: var(--display, 'Cormorant Garamond', Georgia, serif); font-size: 34px; font-weight: 600; }
.account-page h2 { margin: 0 0 12px; font-size: 18px; font-weight: 600; }
.account-page section { border-top: 1px solid var(--line); padding-top: 22px; }
.acc-info { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.acc-info dt { color: var(--muted); }
.acc-info dd { margin: 0; }
.account-page .danger p { margin: 0 0 14px; }
.btn.danger { border-color: #A3312A; color: #A3312A; }
.btn.danger:hover { background: #A3312A; color: #fff; }
@media (max-width: 780px) { .account-page { margin: 12px; padding: 20px; } }

/* Окно «текст не сохранён» */
dialog.leave { border: 1px solid var(--line); border-radius: 10px; padding: 24px 26px; max-width: 440px; width: calc(100% - 32px); color: var(--ink); box-shadow: 0 12px 40px rgba(27, 34, 48, .25); }
dialog.leave::backdrop { background: rgba(27, 34, 48, .35); }
.leave-t { margin: 0 0 12px; font-size: 18px; font-weight: 500; }
.leave-b { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---- Экспорт в PDF ---- */
dialog.export { border: 1px solid var(--line); border-radius: 10px; padding: 0; width: min(520px, calc(100% - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; color: var(--ink); box-shadow: 0 12px 40px rgba(27, 34, 48, .25); }
dialog.export::backdrop { background: rgba(27, 34, 48, .35); }
dialog.export header { display: flex; align-items: center; justify-content: space-between; padding: 18px 24px 12px; border-bottom: 1px solid var(--line); }
dialog.export h2 { margin: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 28px; font-weight: 600; }
dialog.export .x { display: block; margin: 0; }
dialog.export section { padding: 16px 24px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
dialog.export section .lbl { margin: 0; }
dialog.export section.list { gap: 4px; }
dialog.export .row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; font-size: 15px; cursor: pointer; }
dialog.export .fld { display: grid; gap: 6px; padding: 8px 0; }
dialog.export footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px 20px; flex-wrap: wrap; }
.sw { position: relative; width: 44px; height: 26px; flex: none; }
.sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sw span { position: absolute; inset: 0; border-radius: 999px; background: #D9D5CC; pointer-events: none; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: left .15s; }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { left: 21px; }
.sw input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Лист A4: на экране — предпросмотр поверх страницы */
#print-root { position: fixed; inset: 0; z-index: 100; background: #D9D6CF; overflow-y: auto; padding: 0 12px 40px; }
#print-root .pr-bar { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 12px 4px; background: #D9D6CF; max-width: 210mm; margin: 0 auto; }
#print-root .pr-bar .hint { margin: 0; flex-basis: 100%; }
.pr-sheet { box-sizing: border-box; width: 210mm; max-width: 100%; min-height: 297mm; margin: 0 auto; background: #fff; padding: 14mm 15mm 16mm; color: var(--ink); box-shadow: 0 4px 24px rgba(0,0,0,.18); }
.pr-nd { display: flex; justify-content: flex-end; gap: 24px; font-family: var(--ui); font-size: 10pt; margin-bottom: 8mm; }
.pr-nd i { display: inline-block; width: 42mm; border-bottom: 1px solid #9AA0A8; margin-left: 4px; }
.pr-nd span:last-child i { width: 28mm; }
.pr-title { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 22pt; font-weight: 600; margin: 0 0 2mm; }
.pr-sub { font-family: var(--ui); font-size: 11pt; color: #5A6270; margin: 0 0 4mm; }
.pr-sheet .pr-txt { font-size: var(--pr-size); line-height: 2.3; max-width: none; margin-top: 4mm; }
.pr-sheet .pr-legend { margin-top: 8mm; font-size: 9.5pt; break-inside: auto; }
.pr-sheet .pr-legend li { font-size: 9.5pt; break-inside: avoid; }
.pr-sheet .pr-legend .lg-s { font-size: 13pt; }
.pr-sheet .pr-legend ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pr-credit, .pr-wm { font-family: var(--ui); font-size: 7.5pt; color: #8A909A; margin: 8mm 0 0; }
.pr-wm { margin-top: 2mm; }

@media print {
  html, body { background: #fff !important; }
  body.printing > *:not(#print-root) { display: none !important; }
  body.printing #print-root { position: static; background: none; padding: 0; overflow: visible; }
  body.printing #print-root .pr-bar { display: none; }
  body.printing .pr-sheet { width: auto; min-height: 0; padding: 0; margin: 0; box-shadow: none; }
  .pr-sheet, .pr-sheet * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Ctrl+P на рабочей странице без экспорта */
  body.ws:not(.printing) > * { display: none !important; }
  body.ws:not(.printing)::after { content: "Pour imprimer un texte mis en couleur, utilisez le bouton « Exporter en PDF » de Lisons (abonnements Étudiant et Prof)."; display: block; font: 12pt Jost, sans-serif; padding: 20mm; }
}

/* Тарифы */
.pricing { max-width: 1100px; margin: 0 auto; padding: 32px 24px 56px; display: grid; gap: 20px; justify-items: center; }
.pricing h1 { margin: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 44px; font-weight: 600; text-align: center; }
.pricing .founder { margin: 0; padding: 10px 18px; border-radius: 999px; background: #E8EEF7; color: var(--accent); font-size: 15px; text-align: center; }
.pricing .period { width: min(520px, 100%); }
.pcs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; width: 100%; }
.pc { background: var(--paper); border: 1px solid var(--line); border-radius: 10px; padding: 26px 24px; display: flex; flex-direction: column; gap: 8px; }
.pc h2 { margin: 0; font-family: 'Cormorant Garamond', Georgia, serif; font-size: 30px; font-weight: 600; }
.pc-who { margin: 0; color: var(--muted); }
.pc-price { margin: 10px 0 0; }
.pc-num { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 44px; font-weight: 600; line-height: 1; }
.pc-per { color: var(--muted); }
.pc-old { color: var(--muted); text-decoration: line-through; font-size: 20px; margin-right: 4px; }
.pc-note { margin: 0; font-size: 14px; color: var(--muted); }
.pc ul { margin: 12px 0 18px; padding-left: 18px; display: grid; gap: 6px; flex: 1; }
.pc .btn { align-self: stretch; }
.pc-cur { margin: 0; text-align: center; font-weight: 500; color: var(--accent); }
.pricing-legal { max-width: 760px; text-align: center; }
@media (max-width: 860px) { .pcs { grid-template-columns: 1fr; } .pricing h1 { font-size: 34px; } }
