/* An instrument, not a brochure.
   Cold near-black, hairline rules, a hard grid, monospaced numerals, uppercase
   micro-labels. One accent. No cream paper, no rounded cards with soft shadows,
   no serif headings - that vocabulary is already taken, and a product that
   measures people should not look like a greeting card. */

:root {
  color-scheme: dark light;

  --bg:      #0b0c0e;
  --panel:   #121417;
  --raised:  #191c21;
  --line:    #232830;
  --line-2:  #2f353f;
  --ink:     #e9ecf1;
  --muted:   #98a1ad;
  --dim:     #616a77;
  --accent:       #00c896;   /* mint: hairlines, active borders, links, text */
  --accent-d:     #00e5ab;   /* brighter mint, for the second-stage bar */
  --accent-strong:#0b7f5f;   /* deeper green for filled controls */
  --accent-hover: #096b50;   /* filled control, hover */
  --on-accent:    #eafff6;   /* text/icons on any green fill */
  --warn:    #ff7a5c;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --sans: ui-sans-serif, -apple-system, "Segoe UI Variable Text", "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:      #ffffff;
    --panel:   #fbfcfd;
    --raised:  #f4f6f8;
    --line:    #e3e7ec;
    --line-2:  #ccd3db;
    --ink:     #0c0e11;
    --muted:   #59616d;
    --dim:     #8a929d;
    --accent:       #00916d;
    --accent-d:     #007a5c;
    --accent-strong:#0a7c5d;
    --accent-hover: #086a4f;
    --on-accent:    #ffffff;
    --warn:    #c8492c;
  }
}

* { box-sizing: border-box; }

/* `hidden` перебивался любым нашим `display`: `.consents` объявлен `flex`, и
   блок согласия показывался на экране входа, где он должен быть скрыт. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.62 var(--sans);
  letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

h1, h2, h3 { font-family: var(--sans); font-weight: 620; letter-spacing: -0.022em;
             margin: 0; }
/* A golden progression from the 16px body: 16 → 26 → 42 (≈ ×1.618). */
h1 { font-size: 42px; line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: 26px; }
h3 { font-size: 18px; font-weight: 600; }

/* Micro-label: what an instrument calls its scales. */
.label {
  font-size: 11.5px; font-weight: 600; letter-spacing: .13em;
  text-transform: uppercase; color: var(--dim);
}
.num { font-family: var(--mono); font-variant-numeric: tabular-nums;
       letter-spacing: -0.02em; }

/* ------------------------------------------------------------------- frame */

header.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: stretch;
  height: 60px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 24px;
         border-right: 1px solid var(--line); cursor: pointer; }
.brand b { font-weight: 660; font-size: 16px; letter-spacing: -0.02em; }
.brand .dot { width: 8px; height: 8px; background: var(--accent); border-radius: 50%;
              box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
nav.top-links { display: flex; }
nav.top-links a {
  display: flex; align-items: center; padding: 0 20px;
  color: var(--muted); font-size: 14.5px;
  border-right: 1px solid var(--line);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
nav.top-links a:hover { color: var(--ink); background: var(--panel); }
nav.top-links a.on { color: var(--ink); border-bottom-color: var(--accent); }
.spacer { flex: 1; }
.top .right { display: flex; align-items: center; gap: 16px; padding: 0 20px;
              border-left: 1px solid var(--line); font-size: 14px; }

main { max-width: 1200px; margin: 0 auto; padding: 56px 32px 120px; }
.lede { color: var(--muted); max-width: 64ch; margin: 16px 0 40px; font-size: 17px;
        line-height: 1.6; }
.head { border-bottom: 1px solid var(--line); padding-bottom: 28px; margin-bottom: 40px; }

/* ------------------------------------------------------------------- parts */

.tag {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 13px; color: var(--muted); background: transparent;
}
.tag b { color: var(--dim); font-weight: 500; font-family: var(--mono); font-size: 12px; }
.tag.pick { cursor: pointer; }
.tag.pick:hover { border-color: var(--accent); color: var(--ink); }
.tag.pick.on { border-color: var(--accent-strong); color: var(--on-accent);
               background: var(--accent-strong); }
.tag.pick.on b { color: var(--on-accent); opacity: .7; }
.tag.live { border-color: var(--accent); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 20px; border-radius: 8px;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink);
  font-size: 14.5px; letter-spacing: -0.005em;
  transition: border-color .12s, background .12s, color .12s, transform .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
.btn.main { background: var(--accent-strong); border-color: var(--accent-strong);
            color: var(--on-accent); font-weight: 580; }
.btn.main:hover { background: var(--accent-hover); border-color: var(--accent-hover);
                  color: var(--on-accent); transform: translateY(-1px); }
.btn.flat { border-color: transparent; color: var(--muted); padding: 0 10px; }
.btn.flat:hover { border-color: transparent; color: var(--ink); background: var(--panel); }

/* Флажки и переключатели сюда не попадают. Правило раздавало им `width: 100%`,
   отступы 8x11 и рамку - то есть галочка рисовалась коробкой во всю ширину, и
   в разметке стоял костыль `style="width:auto"`, который чинил только ширину. */
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  font: inherit; font-size: 14px; color: var(--ink); background: var(--panel);
  border: 1px solid var(--line-2); border-radius: 3px; padding: 8px 11px; width: 100%;
}
input[type="checkbox"], input[type="radio"] {
  width: 17px; height: 17px; flex: none; margin: 0; padding: 0;
  accent-color: var(--accent); cursor: pointer;
}
input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }
.field { margin-bottom: 14px; }
.field .label { display: block; margin-bottom: 6px; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 3px; }
.pad { padding: 20px 22px; }
.rule { height: 1px; background: var(--line); border: 0; margin: 32px 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); font-size: 12.5px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row > .btn { flex: 1 1 auto; }
.wrap { display: flex; gap: 6px; flex-wrap: wrap; }

.note { padding: 12px 14px; border: 1px solid var(--line); border-left: 2px solid var(--line-2);
        border-radius: 0 3px 3px 0; color: var(--muted); font-size: 13px;
        background: var(--panel); }
.note.bad { border-left-color: var(--warn); color: var(--warn); }

/* The difficulty scale - five divisions, as on a dial. */
.hard { display: inline-flex; gap: 2px; align-items: center; }
.hard i { width: 3px; height: 12px; background: var(--line-2); display: block; }
.hard i.on { background: var(--accent); }

/* --------------------------------------------------------------- catalogue */

.finder { display: flex; gap: 0; border: 1px solid var(--line-2); border-radius: 3px;
          overflow: hidden; max-width: 620px; }
.finder input { border: 0; background: transparent; }
.finder button { border: 0; border-left: 1px solid var(--line-2); background: var(--panel);
                 padding: 0 18px; color: var(--muted); font-size: 13px; }
.finder button:hover { color: var(--accent); }

/* Roomier cards: a real gap between them, a soft border and a lift on hover.
   Bigger tiles, bigger type, more breathing room than the old hairline grid. */
.grid { display: grid; gap: 22px;
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

.tile { background: var(--panel); display: flex; flex-direction: column;
        border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
        transition: transform .16s ease, border-color .16s, box-shadow .16s; }
.tile:hover { transform: translateY(-4px); border-color: var(--line-2);
              box-shadow: 0 16px 38px rgba(0,0,0,.30); }
.tile .shot { aspect-ratio: 4/5; background: var(--raised); position: relative;
              overflow: hidden; }
.tile .shot img { width: 100%; height: 100%; object-fit: cover; display: block;
                  filter: saturate(.9) contrast(1.03); transition: filter .25s, transform .45s; }
.tile:hover .shot img { filter: saturate(1.06) contrast(1.03); transform: scale(1.045); }
.tile .shot .none { position: absolute; inset: 0; display: grid; place-items: center;
                    color: var(--dim); font-family: var(--mono); font-size: 46px; }
.tile .body { padding: 20px 22px 22px; display: flex; flex-direction: column;
              gap: 12px; flex: 1; }
.tile h3 { font-size: 20px; font-weight: 620; letter-spacing: -0.02em; }
/* Теги на плитке. Стояли простым серым текстом в ряд - «довга терапія
   частково недосяжний для досвідчених» читалось как оборванная фраза, а не как
   три метки. Оформление тега в этом файле уже было (`.tag`), к плиткам просто
   не применялось. */
.tile .tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tile .tags span {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 12px; line-height: 1.5; color: var(--muted); white-space: nowrap;
}
.tile .foot { display: flex; gap: 14px; align-items: center; margin-top: auto;
              padding-top: 16px; border-top: 1px solid var(--line);
              font-size: 13px; color: var(--muted); }
.tile .foot .num { font-size: 13px; }

/* ------------------------------------------------------------------- agent */

.agent-head { display: grid; grid-template-columns: 340px 1fr; gap: 40px; }
.portrait { border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
            background: var(--raised); }
.portrait img { width: 100%; display: block; }
.faces { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
         gap: 1px; background: var(--line); border: 1px solid var(--line);
         border-top: 0; }
.faces img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
             cursor: pointer; opacity: .5; filter: grayscale(.4); transition: .15s; }
.faces img:hover, .faces img.on { opacity: 1; filter: none; }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
         gap: 1px; background: var(--line); border: 1px solid var(--line);
         border-radius: 3px; overflow: hidden; margin: 26px 0; }
.facts div { background: var(--panel); padding: 18px 20px; }
.facts b { display: block; font-family: var(--mono); font-size: 29px; font-weight: 500;
           letter-spacing: -0.03em; margin-bottom: 5px; }

.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; padding: 0 1px; font-size: 17px;
                color: var(--line-2); line-height: 1; }
.stars button.on, .stars button:hover { color: var(--accent); }
.stars .set { color: var(--accent); }

.review { padding: 14px 0; border-bottom: 1px solid var(--line); }
.review:last-child { border-bottom: 0; }

/* -------------------------------------------------------------------- chat */

.chat { display: grid; grid-template-columns: 268px 1fr; gap: 32px; align-items: start; }
.chat .side { position: sticky; top: 76px; }
.chat .face { border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
              background: var(--raised); aspect-ratio: 4/5; }
.chat .face img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gauge { height: 3px; background: var(--line); margin: 14px 0 7px; }
.gauge i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* Без `min-height`. Полэкрана резерва держали окно ввода на месте между
   ходами, но в пустой сессии это пустота от приветствия до окна ввода. */
.talk { display: flex; flex-direction: column; gap: 14px; }
/* Лицо у каждой реплики. Чат прокручивается, и одна фотография сбоку
   показывает только последний ход - смотрят на тот, который читают. */
.turn { max-width: 76%; display: flex; gap: 12px; align-items: flex-start; }
.turn .saidwrap { flex: 1 1 auto; min-width: 0; }
.turnface { width: 44px; height: 55px; flex: none; object-fit: cover;
            border: 1px solid var(--line); border-radius: 3px; cursor: zoom-in;
            background: var(--raised); }
.turnface:hover { border-color: var(--accent); }

/* Увеличенное лицо. Закрывается нажатием в любом месте, кнопкой и Escape.
   `inset` отдельными сторонами: в браузере, который его не знает, у fixed
   остаются auto и слой съёживается до картинки - страница под ним остаётся
   нажимаемой, а закрыть нечем. Так и было на телефоне. */
.facebox { position: fixed; inset: 0; top: 0; right: 0; bottom: 0; left: 0;
           width: 100%; height: 100%; z-index: 60; display: flex;
           align-items: center; justify-content: center; padding: 24px;
           background: rgba(0, 0, 0, 0.72); cursor: zoom-out; }
.facebox img { max-width: min(420px, 90vw); max-height: 86vh; border-radius: 4px;
               display: block; }
/* Кнопка на случай, когда нажатие по фону не срабатывает: палец на телефоне
   попадает в картинку, а вокруг неё места почти нет. */
.facebox .shut { position: absolute; top: 10px; right: 12px; z-index: 1;
                 width: 44px; height: 44px; border-radius: 50%; border: none;
                 background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 24px;
                 line-height: 1; cursor: pointer; }
.facebox .shut:hover { background: rgba(0, 0, 0, 0.8); }
.turn.mine { align-self: flex-end; text-align: right; }
.turn .who { margin-bottom: 5px; }
.turn .said { padding: 11px 14px; border-radius: 3px; line-height: 1.5;
              border: 1px solid var(--line); background: var(--panel); text-align: left; }
.turn.mine .said { border-color: var(--accent); background: transparent; }

.composer { display: flex; gap: 10px; margin-top: 24px; align-items: flex-end; }
.composer textarea { resize: vertical; min-height: 42px; flex: 1 1 auto; }
/* `flex: none` и `nowrap`: без них кнопка сжималась до ширины слова и «Say it»
   вставало в две строки. */
.composer .btn { height: 42px; flex: 0 0 auto; white-space: nowrap; }

/* Насколько твёрдо он это о себе знает. Метка стоит только там, где не
   `exact`: у точного ответа метки нет, иначе их двадцать и они ничего не
   различают. */
.tag.knows { border-color: var(--line-2); color: var(--muted); font-size: 11px; }

/* Сон. Отделён от списка прядей: пряди - это то, что он перебирал, а сон -
   то, чем это обернулось ночью. */
.note.dream { border-left: 2px solid #6aa9d8; }
.note.dream p { font-style: italic; }

/* Значок «убрать» на самой карточке, в углу картинки.
   Кнопка не внутри ссылки, а поверх неё: вложенная в `<a>`, она при нажатии
   сначала уводила бы на страницу терапии. Размер 34 - палец на телефоне. */
.tile-wrap { position: relative; }
.tuck { position: absolute; top: 8px; right: 8px; z-index: 2;
        width: 34px; height: 34px; display: flex; align-items: center;
        justify-content: center; padding: 0; border: none; border-radius: 50%;
        background: rgba(0, 0, 0, 0.45); color: #fff; cursor: pointer;
        opacity: 0.75; transition: opacity .12s, background .12s; }
.tuck:hover { opacity: 1; background: rgba(0, 0, 0, 0.7); }
.tuck[disabled] { opacity: .35; cursor: not-allowed; }

/* Вкладки внутри страницы. Те же правила, что у верхней навигации: подчёркнута
   та, что открыта, и ничего больше. */
.tabs { display: flex; gap: 0; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.tabs button { display: flex; align-items: center; gap: 8px; padding: 10px 18px;
               border: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
               background: transparent; color: var(--muted); font-size: 14.5px;
               cursor: pointer; }
.tabs button:hover { color: var(--ink); background: var(--panel); }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }

/* Пока ход идёт. Три точки после слова мигают, само слово стоит: человек
   должен видеть, что это работа, а не зависшая страница. Ход держит около
   тридцати секунд, и всё это время на экране было три точки без объяснения. */
.thinking::after { content: "…"; animation: dots 1.4s steps(4, end) infinite; }
@keyframes dots { 0% { opacity: .25 } 50% { opacity: 1 } 100% { opacity: .25 } }
@media (prefers-reduced-motion: reduce) { .thinking::after { animation: none } }
/* Лицо в пузыре ожидания: то, что придёт с ответом. На телефоне портрет
   наверху страницы не виден, пока человек внизу у поля ввода. */
.tellface { width: 32px; height: 32px; border-radius: 50%; object-fit: cover;
            vertical-align: middle; margin-right: 8px; }
.tellface[hidden] { display: none; }

/* Панель знаков. Сетка, а не строка: сорок пять штук в строку не встают ни
   на телефоне, ни на экране. */
.emoji { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
         gap: 2px; margin-top: 8px; padding: 8px; border: 1px solid var(--line);
         border-radius: 4px; background: var(--panel); }
.emoji .pick { font-size: 22px; line-height: 1; height: 40px; border: none;
               border-radius: 4px; background: transparent; cursor: pointer; }
.emoji .pick:hover { background: var(--raised); }
/* Кнопка знаков не растягивается и не жмётся под текст кнопки отправки. */
.composer #emo { width: 42px; padding: 0; font-size: 20px; }

.past { border: 1px solid var(--line); border-radius: 3px; padding: 14px 16px;
        margin-bottom: 26px; background: var(--panel); }
.past summary { cursor: pointer; color: var(--muted); font-size: 13px; list-style: none; }
.past summary::-webkit-details-marker { display: none; }
.past summary::before { content: "▸ "; color: var(--dim); }
.past[open] summary::before { content: "▾ "; }
.past p { font-size: 13px; }

/* ------------------------------------------------------------------- panel */

/* Фоном сетки был цвет разделителя, а плитки ложились поверх него с зазором
   в пиксель. Три плитки на двух колонках оставляли четвёртую ячейку пустой, и
   в ней этот фон читался как серый квадрат ниоткуда. Линии теперь рисуют сами
   плитки, и пустого места не остаётся. */
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 1px; background: var(--panel); border: 1px solid var(--line);
            border-radius: 3px; overflow: hidden; }
.readouts div { background: var(--panel); padding: 18px 20px;
                box-shadow: 0 0 0 1px var(--line); }
.readouts b { display: block; font-family: var(--mono); font-size: 30px; font-weight: 500;
              letter-spacing: -0.035em; margin-bottom: 6px; }
.readouts .key { color: var(--accent); }

.bars { display: flex; flex-direction: column; gap: 1px;
        border: 1px solid var(--line); border-radius: 3px; background: var(--line); }
.bar-row { display: grid; grid-template-columns: 240px 1fr 62px; gap: 16px;
           align-items: center; font-size: 13px; background: var(--panel);
           padding: 11px 16px; }
.bar { height: 4px; background: var(--line-2); }
.bar i { display: block; height: 100%; background: var(--accent); }

table.plain { width: 100%; border-collapse: collapse; font-size: 13px; }
table.plain th { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line-2); }
table.plain td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
table.plain tr:last-child td { border-bottom: 0; }
table.plain td.n { font-family: var(--mono); font-variant-numeric: tabular-nums; }

.tiers { display: grid; gap: 1px; background: var(--line);
         border: 1px solid var(--line); border-radius: 3px; overflow: hidden;
         grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.tier { background: var(--panel); padding: 24px 22px; display: flex; flex-direction: column; }
.tier.now { background: var(--raised); box-shadow: inset 2px 0 0 var(--accent); }
.tier .price { font-family: var(--mono); font-size: 32px; font-weight: 500;
               letter-spacing: -0.04em; margin: 14px 0 18px; }
.tier ul { list-style: none; padding: 0; margin: 0 0 22px; flex: 1; }
.tier li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px;
           color: var(--muted); }
.tier li:last-child { border-bottom: 0; }

.narrow { max-width: 380px; margin: 56px auto; }

/* Согласие. Флажок и текст в строке, текст переносится под собой, а не под
   флажком: ссылки внутри делают его в две-три строки на телефоне. */
/* Флажки согласия. Класс `agree`, а не `consent`: `.consent` уже занят плашкой
   про cookie ниже в этом файле, и она `position: fixed` внизу экрана. Флажок с
   тем же классом уезжал туда же - на телефоне это была белая полоса с
   квадратиком у нижнего края, - а из сетки выпадал, и текст рассыпался по
   одному слову в первой колонке. */
.consents { margin-bottom: 14px; display: flex; flex-direction: column; gap: 10px; }
.consents label { display: grid; grid-template-columns: 17px 1fr; gap: 9px;
                  align-items: start; font-size: 13px; color: var(--muted);
                  line-height: 1.45; cursor: pointer; }
.consents .agree { margin-top: 1px; }
.consents a { color: var(--accent); }

select.lang { width: auto; padding: 4px 8px; font-size: 12.5px; background: transparent;
              border-color: var(--line); color: var(--muted); }

@media (max-width: 720px) {
  /* Шапка становится двумя строками: название и вход сверху, меню под ними.
     Замерено на 375px - «тренажёр терапевта» переносилось в две строки и
     растягивало первую строку, пункты меню ломались там же, а блок справа
     заезжал поверх названия. */
  header.top { height: auto; flex-wrap: wrap; align-items: center; }

  /* Уточнение под названием. На телефоне оно только ломает строку - само
     название уже сказано. */
  .tagline { display: none; }

  .brand { flex: 0 0 auto; padding: 0 14px; height: 52px; }
  .spacer { display: none; }

  /* Прижат вправо и в одну строку с названием. */
  .top .right { margin-left: auto; border-left: 0; gap: 10px; padding: 0 12px;
                height: 52px; flex-wrap: nowrap; }
  .top .right a.muted { display: none; }   /* тариф виден на своей странице */
  .top .right .btn { padding: 0 14px; }

  /* Меню - вторая строка, одной полосой. `nowrap` и меньший шрифт: четыре
     пункта при 13px занимают около 300px из 375, пятый (оператору) - около
     360. Переносить их значит получить разную высоту у соседних пунктов. */
  nav.top-links { order: 3; width: 100%; border-top: 1px solid var(--line);
                  flex-wrap: wrap; }
  /* `flex: 1 1 auto` - пункт не уже своего слова. Четыре при 13px занимают
     около 300px из 375 и стоят одной строкой; пятый, который видит оператор,
     переносится на вторую целиком, а не обрезается. */
  nav.top-links a { flex: 1 1 auto; justify-content: center;
                    padding: 10px 10px; font-size: 13px; white-space: nowrap; }
  nav.top-links a:last-child { border-right: 0; }
}

@media (max-width: 860px) {
  .agent-head, .chat { grid-template-columns: 1fr; }
  /* In one column the portrait would otherwise stretch the full width of the
     screen and stop being a portrait. */
  .agent-head > div:first-child { max-width: 340px; }
  .chat .side { position: static; display: grid; grid-template-columns: 120px 1fr;
                gap: 16px; align-items: center; }
  .bar-row { grid-template-columns: 1fr; gap: 6px; }
  nav.top-links a { padding: 0 12px; }
  main { padding: 28px 16px 72px; }
  h1 { font-size: 24px; }
}

/* The documents have to be reachable from every page: somebody deciding
   whether to register does not have an account to find them from. */
footer.bottom {
  border-top: 1px solid var(--line);
  padding: 20px 24px 40px;
  display: flex; gap: 20px; flex-wrap: wrap; align-items: center;
  max-width: 1180px; margin: 0 auto;
  font-size: 12.5px; color: var(--muted);
}
footer.bottom a:hover { color: var(--accent); }
footer.bottom .dim { margin-left: auto; }

h1 + p, .panel h2 + p { margin-top: 8px; }
#view h2 { margin-top: 22px; }
#view h3 { margin-top: 18px; }
#view li { margin: 4px 0; color: var(--muted); }
#view code { font-family: var(--mono); font-size: 12.5px; background: var(--raised);
             padding: 1px 5px; border-radius: 3px; }

/* The account of a turn is opened from the turn itself: somebody asking why is
   looking at the reply when the question occurs to them. */
a.why { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase;
        color: var(--dim); margin-left: 8px; }
a.why:hover { color: var(--accent); }
.tag.warnish { border-color: var(--warn); color: var(--warn); font-size: 10px;
               padding: 1px 6px; }

/* The second stage of a therapy is a different kind of achievement from the
   first, and a bar the same colour as the others says it is more of the same. */
/* Заплакал. Синий, а не красный: это не ошибка и не тревога - это то, ради
   чего час и идёт. */
.tag.tears { border-color: #6aa9d8; color: #6aa9d8; }
/* Вторая строка про ту же запись: без текста и без верхней границы - видно,
   что это продолжение предыдущей, а не второй такой же пункт. */
.bar-row.same { border-top: none; padding-top: 0; }
.tag.second { border-color: var(--accent); color: var(--accent);
              font-size: 10px; padding: 1px 6px; margin-left: 6px; }
.bar i.second { background: var(--accent-d); }

/* --- turn by turn: where a session gave something up ------------------- */
.ostrip { display:flex; align-items:flex-end; gap:3px; height:170px;
          padding-top:8px; overflow-x:auto; }
.obar { flex:1 1 0; min-width:14px; height:100%; display:flex;
        flex-direction:column; justify-content:flex-end; gap:4px; }
.obar span { display:block; background:var(--accent); border-radius:2px 2px 0 0;
             opacity:.55; }
.obar.hot span { background:var(--warn); opacity:1; }
.obar.beat span { background:var(--good, #b8912f); opacity:1; }
.obar em { font-style:normal; font-size:10px; text-align:center;
           color:var(--dim); font-variant-numeric:tabular-nums; }
.turncard { border-left:3px solid var(--warn); padding:2px 0 2px 14px;
            margin-bottom:14px; }
.turncard.beat { border-color:var(--good, #b8912f); }
.turncard p { margin:4px 0 0; color:var(--dim); font-size:14px; }
.turncard .toward { color:var(--accent); }

/* --- asking before loading anything ------------------------------------ */
.consent { position:fixed; left:16px; right:16px; bottom:16px; z-index:50;
           max-width:720px; margin:0 auto; display:flex; flex-wrap:wrap;
           gap:14px; align-items:center; justify-content:space-between;
           background:var(--panel); border:1px solid var(--edge);
           border-radius:4px; padding:16px 18px;
           box-shadow:0 6px 28px rgba(0,0,0,.18); }
.consent-said { flex:1 1 320px; }
.consent-said b { font-size:14px; }
.consent-said p { margin:4px 0 0; color:var(--dim); font-size:13.5px; }
/* Refusing must be as reachable as accepting: same size, same place, no
   colour making one of them the obvious one. */
.consent-buttons { display:flex; gap:8px; }
.consent-buttons .btn { min-width:104px; justify-content:center; }

.tagline{margin-left:.5rem;font-weight:400;font-size:.8em;opacity:.55}

/* Голос и видео в комнате.
   Плеер стоит под текстом, а не вместо него: реплика написана всегда, а
   озвучена по желанию, и текст остаётся тем, что можно перечитать. */
.turn .spoken { width: 100%; max-width: 340px; height: 32px; margin-top: 8px; display: block; }
.turn .clip { width: 100%; max-width: 420px; margin-top: 8px; display: block;
              background: #000; border: 1px solid var(--line); }
.btn.tiny { padding: 3px 9px; font-size: 12px; margin-top: 8px; }
/* Кнопка внутри строки: с рамкой, но не в полный рост. `.btn.flat` для этого
   не годится - прозрачная рамка и приглушённый цвет читаются как подпись, и
   нажать по ней никто не догадывается. */
.btn.small { height: 32px; padding: 0 14px; font-size: 13.5px; }
.filmask:not(:empty) { margin-top: 8px; }

/* Тумблер голоса под окном ввода: это выбор на ход, а не настройка терапии,
   поэтому он рядом с кнопкой отправки, а не в стороне.
   `space-between` тут стояло и ломало вёрстку: длинная подсказка справа сжимала
   флажок до колонки в три строки. Подсказка теперь уступает, а не отжимает. */
.aloudrow { display: flex; align-items: baseline; gap: 8px 16px;
            margin-top: 10px; flex-wrap: wrap; }
.aloud { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
         font-size: 13px; flex: 0 0 auto; }
/* Размер, отступы и рамка - в общем правиле для флажков выше; здесь их
   повторять незачем. */
.aloud input { cursor: pointer; }
.aloud span { white-space: nowrap; }
.aloud input:disabled { cursor: not-allowed; }
.aloud input:disabled + span { color: var(--dim); }
.aloudrow .dim { flex: 1 1 auto; text-align: right; min-width: 0; }

/* Завершение сессии - под окном ввода. Кнопка не главная: она стоит там, где
   на неё смотрят, но не соперничает с «Сказать». */
.closerow { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.closerow .note { margin-top: 10px; max-width: 420px; }

/* До чего он дошёл сам между сессиями. Целыми фразами, поэтому список, а не
   метки в строку: метка шириной в предложение перестаёт быть меткой. */
/* Ход и остаток токенов над полем ввода. Те же два числа, что в боковом
   блоке: на телефоне боковой блок уходит вверх за портретом, и человек,
   который сидит внизу у поля ввода, не знает, сколько ходов осталось. */
.turnbar { display: flex; align-items: baseline; gap: 10px;
           margin: 16px 0 6px; padding-bottom: 6px;
           border-bottom: 1px solid var(--line, #e3e3e3); }
.turnbar .spacer { flex: 1; }

/* Число в шапке, по которому можно нажать за объяснением. Выглядит как текст,
   ведёт себя как кнопка. */
.asktip { background: none; border: 0; padding: 0; font: inherit; cursor: help;
          border-bottom: 1px dotted currentColor; }
#tipline .note { margin: 0 auto; max-width: 1080px; }

/* Неделя между часами. Отбита слева, как сон: это не то, что сказано в
   кабинете, а то, что было с ним, пока кабинета не было. */
.between { margin: 10px 0 0; padding-left: 10px; border-left: 2px solid #b9a06a; }
.between p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.between em { font-style: normal; color: var(--dim, #8a8a8a); margin-right: 6px; }

.reached { margin: 8px 0 0; padding-left: 18px; }
.reached li { margin: 4px 0; color: var(--muted); font-size: 13px; }

/* Пароль заведённого оператором счёта. Крупно и моноширинным: его читают с
   экрана вслух или переносят в другое окно, и один раз. */
.madeuser { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.madeuser .pw { font-family: var(--mono); font-size: 18px; letter-spacing: .06em;
                background: var(--raised); border: 1px solid var(--line);
                border-radius: 3px; padding: 6px 10px; user-select: all; }

/* Ролики на карточке агента. */
.cards { margin-top: 20px; display: flex; flex-direction: column; gap: 14px; }
.cards .card { margin: 0; }
.cards video { width: 100%; display: block; background: #000; border: 1px solid var(--line); }
.cards figcaption { margin-top: 6px; font-size: 13px; color: var(--dim); }

/* Список людей. Оператору: кто есть, что у них, и три действия над каждым. */
.users { display: flex; flex-direction: column; gap: 10px; }
.user { border: 1px solid var(--line); padding: 14px; display: flex;
        flex-direction: column; gap: 10px; }
.user--blocked { opacity: .6; border-left: 2px solid var(--warn); }
.user__who { display: flex; justify-content: space-between; gap: 12px;
             flex-wrap: wrap; align-items: baseline; }
.user__has { margin: 0; display: grid; grid-template-columns: repeat(4, auto);
             gap: 2px 18px; font-size: 13px; justify-content: start; }
.user__has dt { color: var(--dim); }
.user__has dd { margin: 0 0 6px; font-variant-numeric: tabular-nums; }
.user__do { display: flex; gap: 6px; flex-wrap: wrap; }
.user__form:not(:empty) { margin-top: 2px; }

/* Узкий экран. Всё, что добавлено к комнате и к списку людей, на телефоне
   складывается в столбец: подсказки уходят под то, что они поясняют, а сетки
   из четырёх колонок становятся из двух. */
@media (max-width: 640px) {
  /* Подсказка про Enter на телефоне бесполезна - там нет Shift+Enter - и
     только отжимает флажок. */
  .aloudrow .dim { display: none; }
  .aloud span { white-space: normal; }

  .composer { flex-direction: column; align-items: stretch; gap: 8px; }
  .composer .btn { height: 44px; width: 100%; }
  .composer textarea { min-height: 64px; }

  .turn { max-width: 100%; }
  .turn .spoken, .turn .clip { max-width: 100%; }

  .user__has { grid-template-columns: auto 1fr; gap: 2px 12px; }
  .user__do { gap: 8px; }
  .user__do .btn { flex: 1 1 auto; }
  .user__who { gap: 4px; }

  .cards video { max-width: 100%; }

  /* Убрать в архив. Значок стоит поверх портрета, и на телефоне наведения нет
     - приглушённый тёмный кружок на тёмном портрете человек просто не находит.
     Здесь он всегда в полную силу, с обводкой, и размером под палец. */
  .tuck { width: 44px; height: 44px; opacity: 1;
          background: rgba(0, 0, 0, 0.62); box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85); }
}

/* Таблицы админки. Класс `rows`, а не `grid`: `.grid` в этом файле — раскладка
   карточек, и таблица с ним разъезжается. */
.rows { width: 100%; border-collapse: collapse; margin: 10px 0 22px; font-size: 14px; }
.rows th, .rows td { padding: 7px 10px; border-bottom: 1px solid var(--line);
                     text-align: left; vertical-align: top; }
.rows th { font-weight: 600; font-size: 12px; text-transform: uppercase;
           letter-spacing: .04em; color: var(--dim); }
.rows .n { text-align: right; font-variant-numeric: tabular-nums; }
.rows tbody tr:hover { background: var(--raised); }

/* Медкарта. Читают её глазами - какой он, что его двигает, где у него края,
   - поэтому таблицами, а не выгрузкой. Путь записи моноширинным и приглушённо:
   он нужен, чтобы найти поле в файле, и не должен спорить со значением. */
.chartrows { margin-top: 4px; }
.chartrows td.key { font-family: var(--mono); font-size: 12px; color: var(--dim);
                    width: 300px; overflow-wrap: anywhere; }
.chartrows td { padding: 4px 10px; }
.chartrows tbody tr:hover { background: var(--raised); }

/* Выбор набора словарей у кнопки старта. Виден только исследователю. */
.research { display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
            font-size: 13px; color: var(--muted); }
.research span { user-select: none; }

/* Протоколы прохождения. Кнопка на стиль, развёрнутый протокол под ними.
   Таблица в семь колонок на сорок ходов не читается: реплика терапевта и
   ответ клиента - текст, и им нужна ширина, а трём числам хватает края.

   Класс не `turn`: он занят репликами живой сессии выше (`max-width: 76%`),
   и карточка протокола получала его вместе со своим - белое поле обрывалось
   на трёх четвертях ширины, а справа оставалась полоса фона. */
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px;
        border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.tabs .btn.on { border-color: var(--accent); color: var(--accent); }
.tabs .btn .dim { margin-left: 7px; font-family: var(--mono); font-size: 11px; }

.prot { display: flex; flex-direction: column; gap: 1px;
        border: 1px solid var(--line); border-radius: 3px;
        background: var(--line); margin-top: 18px; overflow: hidden; }
.prot-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) 168px;
            background: var(--panel); padding: 13px 16px; gap: 18px;
            align-items: start; }
.prot-row.open { background: var(--raised);
                 box-shadow: inset 2px 0 0 var(--accent); }
.prot-n { font-family: var(--mono); font-size: 12px; color: var(--dim);
          padding-top: 2px; }
.prot-said p { margin: 0; }
.prot-said .asked { color: var(--muted); font-size: 13px; margin-bottom: 7px; }
.prot-said .answered { font-size: 14px; line-height: 1.55; }
.prot-said .touched { margin-top: 8px; font-family: var(--mono); font-size: 11px;
                      color: var(--dim); }
.prot-num { display: flex; flex-direction: column; gap: 3px;
            font-family: var(--mono); font-size: 12px; }
.prot-num span { display: flex; justify-content: space-between; gap: 12px; }
.prot-num i { font-style: normal; color: var(--dim); }
.prot-num .key { color: var(--accent); }

@media (max-width: 760px) {
  .prot-row { grid-template-columns: 28px minmax(0, 1fr); }
  .prot-num { grid-column: 2; flex-direction: row; flex-wrap: wrap;
              gap: 16px; margin-top: 8px; }
  .prot-num span { justify-content: flex-start; gap: 6px; }
}

/* Страница агента. Разделы строкой сверху, под шапкой сайта: столбцом слева
   они забирали 190 пикселей ширины у содержимого и на широком экране стояли
   пустые на две трети высоты.

   Ниже две колонки: в широкой то, за чем на страницу заходят - кто он, цели,
   память, протоколы; в узкой учёт - сколько брали, кто, архив, переменные. */
.agent-page > .dim { margin: 0 0 14px; }
.rail { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 26px;
        padding-bottom: 14px; border-bottom: 1px solid var(--line);
        font-size: 13px; }
.rail button { color: var(--muted); background: none; border: 0;
               font: inherit; cursor: pointer; padding: 6px 12px;
               border-radius: 999px; }
.rail button:hover { color: var(--ink); background: var(--panel); }

.agent-head { margin-bottom: 26px; }
.agent-head h1 { margin: 0 0 8px; }
.agent-head .quote { color: var(--muted); font-size: 15px; margin: 0 0 14px;
                     max-width: 68ch; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
/* Чип - короткий факт. Длинный текст в нём становится пузырём в половину
   экрана: занятие у одного агента - четыре строки. */
.chips span { background: var(--panel); border: 1px solid var(--line);
              border-radius: 999px; padding: 5px 13px; font-size: 12px;
              color: var(--muted); max-width: 40ch; white-space: nowrap;
              overflow: hidden; text-overflow: ellipsis; }

/* Одна колонка во всю ширину, кроме помеченных `half`. В колонке 1fr ключ
   `counts.voice` переносился по одной букве в строку, а протокол - сорок
   строк расшифровки в три колонки - шёл в 1.9fr при пустой правой половине
   экрана. */
.agent-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
              gap: 22px; align-items: start; }
.agent-cols > .box { grid-column: 1 / -1; }
.agent-cols > .box.half { grid-column: auto; }

/* Не `.card`: он занят роликами на витрине (`.cards .card` выше), и правило
   во всю страницу перебило бы его. */
.box { border: 1px solid var(--line); border-radius: 4px;
       background: var(--panel); padding: 20px 22px 22px; min-width: 0; }
.box > h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: 0; }
.box > h2 + .dim { margin: 0 0 14px; font-size: 12px; }
.box > h2 + :not(.dim) { margin-top: 16px; }
.box .rows { margin: 0; }
.box .rows th { font-size: 10px; }
.box .rows td { overflow-wrap: anywhere; }

.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
        margin-top: 14px; }
.nums b { display: block; font-family: var(--mono); font-size: 26px;
          font-weight: 500; letter-spacing: -0.03em; }
.nums span { font-size: 11px; color: var(--dim); }

.about { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 22px;
         align-items: start; margin-top: 16px; }
.about.noface { grid-template-columns: minmax(0, 1fr); }
.about img { width: 100%; border-radius: 3px; display: block; }
.about dl { display: grid; grid-template-columns: 140px minmax(0, 1fr);
            gap: 12px 18px; margin: 0; font-size: 13px; align-items: start; }
.about dt { color: var(--dim); font-family: var(--mono); font-size: 11px;
            padding-top: 2px; }
.about dd { margin: 0; overflow-wrap: anywhere; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 3px;
        font-size: 11px; font-family: var(--mono); background: var(--raised);
        color: var(--muted); white-space: nowrap; }
.pill.high { color: var(--warn); }
.pill.medium { color: var(--accent); }

@media (max-width: 1100px) {
  .agent-cols { grid-template-columns: minmax(0, 1fr); }
  .agent-cols > .box.half { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .about { grid-template-columns: minmax(0, 1fr); }
  .about img { max-width: 200px; }
  .nums { grid-template-columns: repeat(2, 1fr); }
}

/* Анкета. Поиск, разделы, четыре формы записи: оси таблицей, защитные
   реакции таблицей с репликой, искажения полосами, остальное парами. */
.find { width: 100%; margin-top: 14px; background: var(--bg);
        border: 1px solid var(--line); border-radius: 3px; color: var(--ink);
        padding: 8px 11px; font-size: 13px; font-family: inherit; }
.find:focus { outline: none; border-color: var(--accent); }
[data-key][hidden], [data-part][hidden] { display: none; }

[data-part] { margin-top: 26px; }
[data-part] > h3 { margin: 0 0 10px; font-size: 13px; font-weight: 500;
                   letter-spacing: 0.06em; text-transform: uppercase;
                   color: var(--dim); }
[data-part] > h3 .dim, [data-part] > h3 code {
  font-family: var(--mono); letter-spacing: 0; text-transform: none;
  font-size: 12px; }
[data-part] > .lede { margin: 0; font-size: 14px; line-height: 1.6;
                      max-width: 78ch; }
[data-part] + [data-part] { border-top: 1px solid var(--line); padding-top: 22px; }

.defences td { vertical-align: top; padding: 8px 10px; }
.defences td:nth-child(1), .defences td:nth-child(2) { white-space: nowrap; }
.defences td:last-child { font-size: 13px; line-height: 1.5; }
.defences tr.off td { opacity: 0.45; }

/* Полоса занимает всё, что осталось от двух крайних колонок: при `width: auto`
   остаток забирала колонка с числом, и полоса схлопывалась до 30 пикселей при
   ширине таблицы 1630. Дорожка под полосой показывает нулевой вес: без неё
   строка с нулём пустая. */
.bars td:first-child { width: 220px; white-space: nowrap; }
.bars td.bar { width: 100%; padding: 8px 10px; }
.bars td.bar span { display: block; height: 6px; border-radius: 3px;
                    background: var(--raised); }
.bars td.bar i { display: block; height: 6px; border-radius: 3px;
                 background: var(--accent); }
.bars td:last-child { width: 56px; white-space: nowrap; }

.anketa-nums { margin-top: 10px; }
.anketa-nums td { padding: 5px 10px; font-size: 12px; }
.anketa-nums code, .defences code, .bars code { font-size: 11px; color: var(--muted); }

/* Вложенный словарь внутри значения: `card.body` это пять полей, и списком
   пар они читаются, а строкой JSON - нет. */
dl.sub { display: grid; grid-template-columns: 110px minmax(0, 1fr);
         gap: 5px 14px; margin: 6px 0 0; font-size: 12px; }
dl.sub dt { color: var(--dim); font-family: var(--mono); font-size: 11px; }
dl.sub dd { margin: 0; }
.about dd ul.reached { margin: 0; padding-left: 18px; }
.about dd ul.reached li { margin-bottom: 5px; }


/* Как к вам обращаться: имя и пол, в профиле и окном перед стартом терапии. */
.genders { display: flex; gap: 12px; margin: 4px 0 14px; }
.gender { flex: 1; max-width: 150px; display: flex; flex-direction: column; align-items: center;
          gap: 6px; padding: 14px 10px 10px; background: var(--raised); color: var(--muted);
          border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font: inherit;
          font-size: 13.5px; transition: border-color .15s, color .15s, background .15s; }
.gender:hover { border-color: var(--line-2); color: var(--ink); }
.gender:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gender.on { border-color: var(--accent); color: var(--accent); background: var(--panel); }
.veil { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
        justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); }
.veil .ask { width: 100%; max-width: 380px; }
@media (prefers-reduced-motion: reduce) { .gender { transition: none; } }

/* Реплика агента: слова и то, что делает тело (`*...*`), разными блоками. */
.said .words, .a .words, .answered .words { display: block; }
.said .words + .words, .a .words + .words { margin-top: 6px; }
.body { display: block; margin: 8px 0; padding: 6px 10px; border-left: 3px solid var(--accent);
        background: var(--raised); color: var(--muted); font-style: italic; font-size: .92em; }
.body .label { color: var(--accent); }
.body:first-child { margin-top: 0; }
.body:last-child { margin-bottom: 0; }
.body .label { display: block; font-style: normal; margin-bottom: 2px; }

/* Ответ пришёл в сессию, которой нет на экране: ссылка на неё внизу справа. */
#elsewhere { position: fixed; right: 16px; bottom: 16px; z-index: 45;
             display: flex; flex-direction: column; gap: 6px;
             max-width: calc(100vw - 32px); }
#elsewhere .note { color: var(--ink); border-left-color: var(--accent);
                   text-decoration: none; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
#elsewhere .note:hover, #elsewhere .note:focus-visible { border-color: var(--accent); }
