/* Фиолетовая тема «Менталиста»: ночной зал дворца за страницей (bg.js), стеклянные карточки, заголовки с засечками. */
:root {
  --surface: #1a1035;        /* карточки и подложка графика */
  --surface-2: #241647;
  --line: #2f2157;           /* волосяные линии — на шаг от подложки */
  --ink: #efe9ff;
  --ink-2: #c3b6e6;
  --muted: #8f80b8;
  --accent: #b594ff;
  --series: #9a6ef0;         /* линия графика: светлее — уже не проходит проверку на --surface (см. CLAUDE.md) */
  --glow: rgba(154, 110, 240, .45);
  --ok: #6fdca6;
  --bad: #ff8fab;
  --card-face: #f6f1ff;      /* лицо игральной карты; красная масть на нём — 5,3 : 1, чёрная — выше */
  --card-ink: #1d1236;
  --card-red: #c2185b;
  --serif: "PT Serif", Georgia, serif;
  --sans: -apple-system, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
/* PT Serif (лицензия OFL — fonts/OFL.txt): на маке он свой, берётся local(); на айфоне его нет — грузится файл, иначе Georgia */
@font-face { font-family: "PT Serif"; font-weight: 400; font-display: swap; src: local("PT Serif"), local("PTSerif-Regular"), url(fonts/PT_Serif-Web-Regular.ttf) format("truetype"); }
@font-face { font-family: "PT Serif"; font-weight: 700; font-display: swap; src: local("PT Serif Bold"), local("PTSerif-Bold"), url(fonts/PT_Serif-Web-Bold.ttf) format("truetype"); }

* { box-sizing: border-box; }
html { min-height: 100%; background: #0a0614; }
body { margin: 0; color: var(--ink); font: 17px/1.6 var(--sans); }

/* Живой фон — ночной зал дворца (bg.js рисует его на холсте #bg). Позади — туманность из трёх мягких пятен, плывущих
   за минуты; поверх холста — тёмные края и лёгкое зерно, чтобы переходы цвета не шли полосами. */
.layer { position: fixed; inset: 0; pointer-events: none; transition: opacity 1.5s; }
#nebula { z-index: -3; overflow: hidden; background: linear-gradient(180deg, #0a0614 0%, #120a28 55%, #22124a 100%); }
#nebula i { position: absolute; border-radius: 50%; }
#nebula i:nth-child(1) { width: 75vmax; height: 75vmax; left: 40%; top: -35%; background: radial-gradient(closest-side, rgba(150, 100, 255, .34), rgba(150, 100, 255, 0)); animation: n1 70s ease-in-out infinite alternate; }
#nebula i:nth-child(2) { width: 85vmax; height: 65vmax; left: -35%; top: 35%; background: radial-gradient(closest-side, rgba(70, 90, 230, .26), rgba(70, 90, 230, 0)); animation: n2 90s ease-in-out infinite alternate; }
#nebula i:nth-child(3) { width: 55vmax; height: 55vmax; left: 35%; top: 60%; background: radial-gradient(closest-side, rgba(205, 90, 200, .14), rgba(205, 90, 200, 0)); animation: n3 110s ease-in-out infinite alternate; }
@keyframes n1 { to { transform: translate(-16vw, 10vh) scale(1.15); } }
@keyframes n2 { to { transform: translate(14vw, -8vh) scale(.9); } }
@keyframes n3 { to { transform: translate(-20vw, -14vh) scale(1.2); } }
/* под колонкой текста сцена приглушена: рамки окон и лучи не лезут под буквы */
#bg {
  z-index: -2; width: 100%; height: 100%;
  --dim: linear-gradient(90deg, #000 calc(50% - 480px), rgba(0, 0, 0, .5) calc(50% - 400px), rgba(0, 0, 0, .5) calc(50% + 400px), #000 calc(50% + 480px));
  -webkit-mask-image: var(--dim); mask-image: var(--dim);
}
#veil { z-index: -1; background: radial-gradient(125% 95% at 50% 42%, rgba(4, 2, 10, 0) 55%, rgba(4, 2, 10, .7) 100%); }
#grain { z-index: -1; opacity: .06; mix-blend-mode: overlay; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
/* упражнение: сцена замирает (bg.js) и почти гаснет — рядом с цифрами и картами ничего не движется */
body.exercise #nebula { opacity: .6; }
body.exercise #bg { opacity: .12; }
body.exercise #nebula i { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { #nebula i { animation: none; } }

/* полоса разделов */
#bar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 18px; padding: 12px 28px;
  background: rgba(10, 6, 22, .45); backdrop-filter: blur(18px) saturate(1.3); border-bottom: 1px solid rgba(181, 148, 255, .12);
}
#bar:empty, body.exercise #bar { display: none; }
/* в приложении для мака (mac/) страница идёт под кнопки окна: полоса высотой --titlebar — их, шапка ниже */
html.app #bar { padding-top: calc(var(--titlebar, 32px) + 4px); }
.brand { font: 700 22px var(--serif); letter-spacing: .5px; color: var(--ink); text-decoration: none; text-shadow: 0 0 18px var(--glow); }
#bar nav { display: flex; flex-wrap: wrap; gap: 4px; }
#bar nav a { padding: 7px 12px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 15px; }
#bar nav a:hover { color: var(--ink); background: rgba(154, 110, 240, .14); }
#bar nav a[aria-current="page"] { color: #fff; background: rgba(154, 110, 240, .28); box-shadow: 0 0 16px var(--glow); }
.gear { margin-left: auto; padding: 6px 10px; border-radius: 999px; color: var(--ink-2); text-decoration: none; font-size: 20px; line-height: 1; }
.gear:hover, .gear[aria-current="page"] { color: #fff; background: rgba(154, 110, 240, .28); }
/* телефон (12.5): разделы — одна строка, листается вбок; название и так в шапке Telegram */
@media (max-width: 700px) {
  #bar { gap: 4px; padding: 8px 8px 8px 0; }
  #bar .brand { display: none; }
  #bar nav { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-left: 10px; }
  #bar nav a { flex: none; }
}

main { max-width: 880px; margin: 0 auto; padding: 36px 28px 90px; }
@media (max-width: 700px) { main { padding: 22px 16px 72px; } h1 { font-size: 30px; } .card { padding: 18px 16px; } }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.25; margin: 0; }
h1 { font-size: 38px; margin-bottom: 18px; text-shadow: 0 0 26px var(--glow); text-wrap: balance; }   /* одно слово не остаётся на второй строке */
h2 { font-size: 24px; }
h3 { font-size: 19px; margin-top: 26px; color: var(--accent); }
p { margin: 12px 0; }
a { color: var(--accent); }
.lead { color: var(--ink-2); font-size: 18px; margin: 0 0 26px; }
.sub, .note { color: var(--muted); font-size: 15px; }
.soon { color: var(--muted); font-size: 15px; margin: 6px 0 0; }

/* карточка — стекло: фон виден сквозь неё размытым */
.card {
  background: rgba(22, 13, 46, .56); border: 1px solid rgba(181, 148, 255, .14); border-radius: 16px; backdrop-filter: blur(16px) saturate(1.25);
  padding: 22px 24px; margin: 0 0 18px; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 24px 60px -16px rgba(2, 1, 8, .7);
}
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid .card { margin: 0; }
/* «Тренажёры»: кнопка внизу карточки — в ряду кнопки на одной высоте; у примера нет верхнего отступа: во flex отступы не схлопываются */
.trainers .card { display: flex; flex-direction: column; }
.trainers .card .example { margin-top: 0; }
.trainers .card > :last-child { margin-top: auto; align-self: flex-start; }
@media (max-width: 700px) { .grid { grid-template-columns: 1fr; } }
.card.off { opacity: .62; }
.card .eyebrow { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 1.2px; }
.card .example { color: var(--ink-2); font-size: 15px; border-left: 2px solid var(--line); padding-left: 12px; margin: 10px 0 14px; }
a.card { display: block; color: inherit; text-decoration: none; transition: box-shadow .2s, border-color .2s; }
a.card:hover { border-color: var(--series); box-shadow: 0 0 28px var(--glow); }
.badge { display: inline-block; white-space: nowrap; padding: 2px 10px; border-radius: 999px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); }
.badge.done, .badge.yes { color: var(--ok); border-color: rgba(111, 220, 166, .4); }
.badge.open { color: var(--bad); border-color: rgba(255, 143, 171, .4); }

/* кнопки: мягкое свечение */
.btn {
  display: inline-block; padding: 10px 22px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); font: 600 16px var(--sans); text-decoration: none; cursor: pointer;
  transition: box-shadow .2s, transform .1s;
}
.btn:hover { box-shadow: 0 0 22px var(--glow); }
.btn:active { transform: translateY(1px); }
.btn.primary { border-color: transparent; background: linear-gradient(135deg, #8a5cf6, #b07cff); color: #fff; box-shadow: 0 0 26px var(--glow); }
.btn.primary:hover { box-shadow: 0 0 40px rgba(176, 124, 255, .75); }
.btn.ghost { background: transparent; color: var(--ink-2); }
section > .actions > .btn.ghost { background: var(--surface-2); }       /* вне карточки сквозь прозрачную кнопку видны рамы окон фона */
.btn:disabled { opacity: .4; cursor: default; box-shadow: none; transform: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.actions > .note { align-self: center; }                                 /* подпись рядом с кнопкой — по её середине, а не по верху ряда */

.banner { padding: 10px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.banner.bad { background: #3a1d2b; border-color: #7a3550; color: #ffd9e3; }

.guard { max-width: 560px; margin: 16vh auto 0; padding: 30px 34px; text-align: center; background: rgba(26, 16, 53, .9); border: 1px solid var(--line); border-radius: 18px; }

/* урок */
.lesson p, .lesson li { color: var(--ink-2); }
.lesson b { color: var(--ink); }
.lesson ul { padding-left: 22px; }
.lesson blockquote { margin: 14px 0; padding: 2px 0 2px 18px; border-left: 3px solid var(--series); color: var(--ink); }
.lesson h3 .badge { font: 13px/1.6 var(--sans); vertical-align: 2px; }   /* от заголовка — пробелом, не отступом: перенесённая метка встаёт ровно под ним */
.lesson .cite { display: block; margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
/* читалка книги Фоера: сноска — мелко под своим абзацем, картинка — по ширине текста */
.reader p.note { color: var(--muted); font-size: 15px; padding-left: 12px; border-left: 2px solid var(--line); }
.reader sup { line-height: 0; }
.reader img { display: block; max-width: 100%; margin: 14px auto; border-radius: 6px; }
ol.reading { padding-left: 24px; }
ol.reading li { margin: 8px 0; }
.sources { margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
ol.list { list-style: none; padding: 0; margin: 0; }
ol.list li { display: flex; align-items: baseline; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
ol.list li:last-child { border-bottom: 0; }
ol.list .num { color: var(--muted); font: 15px var(--mono); min-width: 28px; }
ol.list a { font: 700 19px var(--serif); text-decoration: none; }
ol.list .badge { margin-left: auto; }
ol.diary { list-style: none; padding: 0; margin: 18px 0 0; }
ol.diary li { padding: 12px 0; border-top: 1px solid var(--line); }
ol.diary p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* тренажёр «Ряд цифр» */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 6px; }
.chips button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font: 15px var(--sans); cursor: pointer; }
.chips button[aria-pressed="true"] { background: rgba(154, 110, 240, .28); border-color: var(--series); color: #fff; box-shadow: 0 0 16px var(--glow); }
.stage { text-align: center; padding-top: 6vh; }
:is(.stage, .look) .step { color: var(--muted); text-transform: uppercase; letter-spacing: 2px; font-size: 14px; }
.digits { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 26px; margin: 28px 0; font: 600 46px/1.2 var(--mono); text-shadow: 0 0 22px var(--glow); }
.clock { color: var(--ink-2); font: 26px var(--mono); }
.stage .actions { justify-content: center; }
.answer {
  display: block; width: 100%; max-width: 640px; margin: 22px auto 8px; padding: 14px 18px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 30px/1.4 var(--mono); letter-spacing: 3px; text-align: center; resize: vertical;
}
.answer:focus { outline: none; border-color: var(--series); box-shadow: 0 0 26px var(--glow); }
.score { font: 700 30px var(--serif); margin: 6px 0 2px; }
.cmp { display: grid; grid-template-columns: auto 1fr; gap: 8px 18px; align-items: baseline; margin: 18px 0; }
.cmp .who { color: var(--muted); font-size: 14px; }
.cmp .row { display: flex; flex-wrap: wrap; gap: 4px 16px; font: 600 26px var(--mono); }
.cmp .ok { color: var(--ok); }
.cmp .bad { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 5px; }

[hidden] { display: none !important; }

/* подсказка в «Ряде цифр»: под цифрой — образ и точка дворца */
.digits span { display: flex; flex-direction: column; align-items: center; }
.digits.hinted span { width: 150px; }                                   /* ровные колонки, какой бы длины ни была точка */
.digits small { font: 16px/1.3 var(--sans); color: var(--ink-2); text-shadow: none; overflow-wrap: anywhere; }
.digits small.at { font-size: 13px; color: var(--muted); }
.chips button:disabled { opacity: .45; cursor: default; }

/* «Слова по порядку»: номер точки, слово, под ним подсказка; при вводе — поле на точку */
.words { list-style: none; padding: 0; margin: 24px auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 28px; max-width: 920px; text-align: left; }
.words li { display: grid; grid-template-columns: 36px 1fr; align-items: baseline; font: 600 24px/1.3 var(--serif); }
.words b { color: var(--muted); font: 600 15px var(--mono); }
.words small { grid-column: 2; font: 13px/1.3 var(--sans); color: var(--muted); overflow-wrap: anywhere; }
/* «Связки»: первое слово вправо, тире, второе влево — пары стоят столбиком по тире; при вводе второе — поле */
.pairs { list-style: none; padding: 0; margin: 24px auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 12px 40px; max-width: 920px; text-align: left; }
.pairs li { display: grid; grid-template-columns: 1fr auto 1fr; gap: 0 12px; align-items: baseline; font: 600 24px/1.3 var(--serif); }
.pairs b { font-weight: inherit; text-align: right; overflow-wrap: anywhere; }
.pairs i { font-style: normal; color: var(--muted); }
.pairs small { grid-column: 3; font: 13px/1.3 var(--sans); color: var(--muted); overflow-wrap: anywhere; }
:is(.words, .pairs).recall li { align-items: center; }
.word-answer { width: 100%; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 20px var(--sans); resize: none; }
.word-answer:focus { outline: none; border-color: var(--series); box-shadow: 0 0 18px var(--glow); }
:is(.words, .pairs).result li.ok span { color: var(--ok); }
:is(.words, .pairs).result li.bad span { color: var(--bad); text-decoration: underline wavy; text-underline-offset: 5px; }
.card :is(.words, .pairs) { margin: 14px 0; }
:is(.words, .pairs).result small { margin-top: 4px; }
.pairs.result b { grid-row: span 2; }                 /* вопрос в две строки: «было: …» — сразу под ответом, а не под вопросом */

/* карточки */
.front { margin: 26px 0 8px; font: 700 96px/1.1 var(--serif); text-shadow: 0 0 34px var(--glow); }
.back { margin: 0 0 6px; font: 700 40px var(--serif); color: var(--accent); }
.study { list-style: none; padding: 0; margin: 22px auto; display: inline-grid; grid-template-columns: repeat(2, auto); gap: 8px 44px; text-align: left; font-size: 20px; color: var(--ink-2); }
.study b { display: inline-block; min-width: 54px; margin-right: 10px; color: var(--ink); font: 700 22px var(--serif); }
.card .study { display: grid; justify-content: start; margin: 12px 0 0; }

/* поле для своего слова: рекомендация и предупреждение — рядом */
.field { width: 100%; min-width: 0; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 17px var(--sans); }
.field:focus { outline: none; border-color: var(--series); box-shadow: 0 0 18px var(--glow); }
.field::placeholder { color: var(--muted); opacity: .7; }
#remind-time { width: auto; margin-left: 4px; }                                  /* «9:00» — не во всю ширину карточки */
.state { font-size: 13px; line-height: 1.35; color: var(--muted); }
.state > * { display: block; text-align: inherit; }
.state:empty { display: none; }
.warn { color: var(--bad); }
.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }

/* таблицы образов */
.shapes { width: 100%; border-collapse: collapse; }
.shapes td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.shapes tr:last-child td { border-bottom: 0; }
.shapes .digit { width: 54px; font: 700 28px var(--serif); color: var(--accent); text-shadow: 0 0 18px var(--glow); }
.shapes .why { color: var(--muted); font-size: 15px; }
.shapes td:last-child { width: 190px; text-align: right; }
.decades { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 34px; }
@media (max-width: 700px) { .decades { grid-template-columns: 1fr; } }
.decade h3 small { color: var(--muted); font: 14px var(--sans); }
.imgs { list-style: none; padding: 0; margin: 10px 0 0; }
.imgs li { display: grid; grid-template-columns: 34px 76px minmax(0, 1fr); gap: 2px 8px; align-items: center; padding: 4px 0; }
.imgs .n { color: var(--accent); font: 700 19px var(--serif); }
.imgs .abc { color: var(--muted); font: 12px var(--mono); white-space: nowrap; }
.imgs .state { grid-column: 3; }
.deck { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 12px; }
.deck th, .deck td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.deck thead th { color: var(--ink-2); font-weight: 600; }
.deck th:first-child { width: 40px; color: var(--accent); font: 700 19px var(--serif); }
.deck .suit-h, .deck .suit-d { color: var(--bad); }
.deck .word { color: var(--ink); }
.deck small { color: var(--muted); }
.deck .field { padding: 6px 10px; font-size: 16px; }

/* дворец */
.steps { padding-left: 22px; color: var(--ink-2); }
.steps li { margin: 6px 0; }
.room { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }
.card > .room:first-child { margin-top: 0; padding-top: 0; border-top: 0; }     /* комната первой в карточке (шаг курса) — без пустой полосы */
.room-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.room-head h3 { margin: 0; }
.room-head .field { flex: 0 1 240px; }
.points { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-auto-flow: column; grid-template-rows: repeat(var(--rows), auto); grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 30px; }
.points li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 2px 10px; align-items: center; align-content: start; }   /* «сохранено» у соседа не опускает поле */
.points .n { text-align: right; color: var(--muted); font: 15px var(--mono); }
.points .state { grid-column: 2; }

/* график: тонкие метки, волосяные оси, текст — не цветом линии */
.kpis { display: flex; flex-wrap: wrap; gap: 12px; margin: 14px 0; }
.kpi { flex: 1 1 120px; padding: 12px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.kpi .label { color: var(--muted); font-size: 13px; }
.kpi .value { font: 600 30px var(--sans); line-height: 1.2; }
.plot { position: relative; background: var(--surface); border-radius: 14px; padding: 8px; }
.plot svg { display: block; width: 100%; height: auto; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .axis { fill: var(--muted); font: 12px var(--sans); font-variant-numeric: tabular-nums; }
.plot .end { fill: var(--ink); font: 600 13px var(--sans); }
.plot .area { fill: var(--series); opacity: .1; }
.plot .line { fill: none; stroke: var(--series); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.plot .dot { fill: var(--series); stroke: var(--surface); stroke-width: 2; }
.plot .cross { stroke: var(--muted); stroke-width: 1; }
.plot .hit { fill: transparent; outline: none; }
.plot .ideal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }   /* «вышло как ждал» */
.tip {
  position: absolute; transform: translate(12px, -120%); pointer-events: none; white-space: nowrap;
  padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 14px; color: var(--ink-2);
}
.tip.flip { transform: translate(calc(-100% - 12px), -120%); }
.tip.below { transform: translate(12px, 16px); }                      /* точка у верхнего края — подсказка под ней */
.tip.below.flip { transform: translate(calc(-100% - 12px), 16px); }
.tip strong { display: block; color: var(--ink); font-size: 16px; }
details { margin-top: 14px; color: var(--ink-2); }
summary { cursor: pointer; color: var(--accent); }
details table, #week-table, #measure-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 15px; font-variant-numeric: tabular-nums; }
details th, details td, #week-table th, #week-table td, #measure-table th, #measure-table td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); }
details th, #week-table th, #measure-table th { color: var(--muted); font-weight: 400; }
#week-table th:first-child, #week-table td:first-child, #measure-table th:first-child, #measure-table td:first-child { text-align: left; padding-left: 0; }
@media (max-width: 700px) {      /* телефон: пять столбцов «Недели в цифрах» — в ширину экрана */
  details table, #week-table, #measure-table { font-size: 13px; }
  details th, details td, #week-table th, #week-table td, #measure-table th, #measure-table td { padding: 6px 4px; }
}

/* «Числа как в жизни»: хозяин числа длиннее слова — одна колонка */
.pairs.facts { grid-template-columns: minmax(0, 1fr); max-width: 760px; }

/* «Дело»: сводка абзацем; на ступенях 5 и 6 подробности выделены, у каждой — номер её точки, под сводкой — маршрут */
.case { max-width: 760px; margin: 24px auto 8px; text-align: left; }
.case h2 { margin: 0 0 8px; }
.case p { margin: 0; font: 22px/1.65 var(--serif); }
.case mark { background: none; color: var(--accent); font-weight: 700; }
.case mark.ask { color: inherit; font-weight: inherit; text-decoration: underline wavy var(--accent); text-underline-offset: 6px; }   /* «Ответ»: вопрос в конце */
#checks .version { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0; }   /* «Ответ»: вопрос и «да / нет» в строку */
#checks .version p { margin: 0; }
#checks .chips { flex: none; margin: 0; }
#held-list b { min-width: 92px; white-space: nowrap; }
.case sup { margin-left: 2px; color: var(--muted); font: 600 12px var(--mono); }
.route { list-style: none; max-width: 760px; margin: 14px auto 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 18px; text-align: left; color: var(--muted); font-size: 14px; }

/* «Досье»: таблица людей; на ступенях 3×2 и 4×3 первый столбец — точка дворца */
.dossier { margin: 24px auto 8px; border-collapse: collapse; text-align: left; font: 22px/1.4 var(--serif); }
.dossier th { padding: 0 28px 8px 0; color: var(--muted); font: 600 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.dossier td { padding: 10px 28px 10px 0; border-top: 1px solid var(--line); }
.dossier .at { color: var(--muted); font: 14px var(--sans); }
@media (max-width: 700px) {      /* телефон: четыре столбца со словом «библиотекарь» влезают в 360 точек */
  .dossier { font-size: clamp(15px, 4.2vw, 22px); }
  .dossier th { padding-right: 10px; }
  .dossier td { padding: 8px 10px 8px 0; }
}

/* «Схема»: дерево — под начальником с отступом его подчинённые, от него к каждому линия */
.tree { display: flex; justify-content: center; margin: 22px 0 8px; text-align: left; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tree li { position: relative; font: 22px/1.4 var(--serif); }
.tree li li { padding-left: 30px; }
.tree ul ul { margin-left: 10px; }
.tree li li::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1px solid var(--muted); }
.tree li li:last-child::before { bottom: auto; height: .75em; }
.tree li li::after { content: ""; position: absolute; left: 0; top: .75em; width: 22px; border-top: 1px solid var(--muted); }

/* «Свой текст»: поле под текст; слова для отметки — кнопки внутри текста; при сверке — ключевые слова и текст рядом с пересказом */
.own-text { display: block; width: 100%; margin: 12px 0 6px; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 17px/1.6 var(--sans); resize: vertical; }
.stage .own-text { max-width: 760px; margin: 18px auto 8px; }
.own-text:focus { outline: none; border-color: var(--series); box-shadow: 0 0 18px var(--glow); }
.own, .own p, .own-cmp p { white-space: pre-wrap; }
p.own { font: 19px/1.7 var(--serif); }
.own .glue { white-space: nowrap; }
.own button { padding: 0 1px; border: 0; border-radius: 4px; background: none; color: inherit; font: inherit; cursor: pointer; }
.own button:hover { background: var(--surface-2); }
.own button[aria-pressed="true"] { background: var(--accent); color: var(--card-ink); }
.keys { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.keys button { padding: 6px 14px; border-radius: 999px; border: 1px solid currentColor; background: none; font: 600 16px var(--sans); cursor: pointer; }
.keys button:disabled { cursor: default; }
:is(.keys button, .own-cmp mark).ok { color: var(--ok); }
:is(.keys button, .own-cmp mark).bad { color: var(--bad); }
.own-cmp { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.own-cmp h3 { margin: 10px 0 6px; color: var(--muted); font: 600 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; }
.own-cmp p { margin: 0; font: 16px/1.6 var(--sans); color: var(--ink-2); overflow-wrap: anywhere; }
.own-cmp mark { background: none; font-weight: 700; }

/* «Колода по порядку»: карта крупно, под ней образ; при вводе — раскладка всей колоды (строка — масть) и места по точкам */
.faces { display: flex; justify-content: center; gap: 24px; margin: 18px 0 6px; }
.faces > div { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.faces small { font: 18px/1.3 var(--sans); color: var(--ink-2); }
.actions + .clock { margin-top: 18px; }                                 /* таймер под кнопками «Назад» и «Дальше» */
.playing { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 150px; height: 210px; border-radius: 14px; background: var(--card-face); color: var(--card-ink); font: 700 64px/1 var(--serif); box-shadow: 0 0 34px var(--glow); }
.playing span { font-size: 72px; }
.deal { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; max-width: 820px; margin: 18px auto 0; }
.deal button { padding: 10px 0; border: 0; border-radius: 8px; background: var(--card-face); color: var(--card-ink); font: 700 17px var(--serif); cursor: pointer; }
.deal button:disabled { opacity: .18; cursor: default; }
.deal button[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 18px var(--glow); }   /* «Какой карты не хватает»: отмеченная */
.slots { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 18px; margin: 14px auto 0; }
.slots .pt { display: inline-flex; align-items: center; gap: 4px; }
.slots .pt b { min-width: 20px; color: var(--muted); font: 13px var(--mono); text-align: right; }
.slot { min-width: 54px; height: 44px; padding: 0 6px; border-radius: 8px; border: 1px dashed var(--muted); background: transparent; color: var(--muted); font: 700 18px var(--serif); cursor: pointer; }
.slot.filled { border: 1px solid transparent; background: var(--card-face); color: var(--card-ink); }
.slot[aria-pressed="true"] { border: 2px solid var(--accent); box-shadow: 0 0 16px var(--glow); }
:is(.playing, .slot.filled, .deal button).red { color: var(--card-red); }
.words.two { grid-template-columns: repeat(4, minmax(0, 1fr)); }       /* итог «парами»: в строке две точки, номер — у первой карты пары */
@media (max-width: 700px) { .words.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* «Счёт карт»: поле под одно число; в итоге — карта, её цена и счёт после неё */
.count-answer { display: block; width: 180px; margin: 18px auto 0; font: 600 30px var(--mono); text-align: center; }
.tally { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.tally li { display: flex; flex-direction: column; align-items: center; padding: 6px 0; border-radius: 8px; background: var(--surface-2); }
.tally b { font: 700 18px var(--serif); }
.tally small { color: var(--muted); font: 12px var(--mono); }

/* мышление: задача, два ответа, уверенность в процентах */
.case p + p { margin-top: 14px; }
.options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: 760px; margin: 26px auto 18px; }
@media (max-width: 700px) { .options { grid-template-columns: 1fr; } }
.options button { padding: 14px 18px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 19px var(--sans); cursor: pointer; }
.options button[aria-pressed="true"] { background: rgba(154, 110, 240, .28); border-color: var(--series); color: #fff; box-shadow: 0 0 16px var(--glow); }
.stage .chips { justify-content: center; }
.sure-table { list-style: none; padding: 0; margin: 8px 0 0; }
.sure-table li { display: flex; gap: 16px; padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.sure-table li:last-child { border-bottom: 0; }
.sure-table b { min-width: 64px; color: var(--ink); font-variant-numeric: tabular-nums; }
.case ol { margin: 14px 0 16px; padding-left: 28px; }                                   /* «Версии и улики»: улики по номерам */
.case li { font: 20px/1.6 var(--serif); margin: 4px 0; }
.versions { max-width: 760px; margin: 8px auto 0; text-align: left; }
.version { padding: 14px 0 2px; border-top: 1px solid var(--line); }
.version h3 { margin: 0 0 2px; }
.version .sub { margin: 8px 0 0; }
.versions .own-text { margin: 6px 0 0; font-size: 16px; }
.versions .chips { justify-content: flex-start; }
.versions .chips button { padding: 6px 11px; }                                          /* одиннадцать процентов — в одну строку */
.cases { list-style: none; padding: 0; margin: 8px 0 0; }
.cases li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cases li:last-child { border-bottom: 0; }
.clues li { margin: 10px 0; color: var(--ink-2); }

/* «Наблюдения»: картина слева во всю высоту окна, справа строки и список деталей; щелчок по картине — увеличить в 2,5 раза */
main:has(> #main > .look) { max-width: 1500px; }
.look { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 400px); gap: 24px; align-items: start; }
.look .step { margin: 0; }
.look .clock { margin: 4px 0 0; }
.canvas { --h: calc(100vh - var(--titlebar, 0px) - 24px); position: sticky; top: calc(var(--titlebar, 0px) + 12px); max-height: var(--h); overflow: auto; border-radius: 12px; }
.frame { position: relative; width: min(100%, var(--h) * var(--r, 1.4)); margin: 0 auto; }
.canvas.zoomed .frame { width: calc(2.5 * min(100%, var(--h) * var(--r, 1.4))); }
.frame img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.canvas.zoomed img { cursor: zoom-out; }
.ring { position: absolute; aspect-ratio: 1; transform: translate(-50%, -50%); border: 3px solid #ffd900; border-radius: 50%; box-shadow: 0 0 0 2px #000, inset 0 0 0 2px #000; pointer-events: none; }
@media (max-width: 900px) { .look { grid-template-columns: 1fr; } .canvas { position: static; } }
.lines { list-style: none; padding: 0; margin: 10px 0 0; }
.lines li { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.lines li > span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.lines .chips { flex-wrap: nowrap; gap: 4px; margin: 0; }
.lines .chips button { padding: 2px 10px; font-size: 13px; }
.details { list-style: none; padding: 0; margin: 10px 0 0; }
.details li { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line); }
.details .link { font-size: 14px; white-space: nowrap; }
.got { position: relative; flex: 1; padding: 6px 8px 6px 30px; border: 0; border-radius: 8px; background: none; color: var(--ink-2); font: 15px/1.4 var(--sans); text-align: left; cursor: pointer; }
.got::before { content: ""; position: absolute; left: 6px; top: 8px; width: 16px; height: 16px; border: 1px solid var(--muted); border-radius: 4px; font: 700 13px/16px var(--sans); text-align: center; }
.got[aria-pressed="true"] { color: var(--ink); background: rgba(111, 220, 166, .1); }
.got[aria-pressed="true"]::before { content: "✓"; border-color: var(--ok); color: var(--ok); }
.details li.err .got { text-decoration: line-through; opacity: .5; cursor: default; }
.missed { padding-left: 22px; color: var(--ink-2); }

/* курс: план дня и строка шага */
ol.list small { display: block; color: var(--muted); font-size: 14px; }
#charts a[aria-current] { color: var(--ink); text-decoration: none; }   /* чей график сейчас открыт */
/* серия дней: календарь слева, числа справа; календарь — неделя строкой, с понедельника */
.streak { display: flex; flex-wrap: wrap; gap: 0 28px; align-items: flex-start; }
.streak > div:last-child { flex: 1 1 260px; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 52px)); gap: 4px; margin: 12px 0; font-size: 13px; text-align: center; font-variant-numeric: tabular-nums; }
.cal b { color: var(--muted); font-weight: 400; }
.cal span { padding: 4px 0; border-radius: 8px; background: var(--surface); color: var(--muted); white-space: nowrap; }
.cal span.on { background: rgba(154, 110, 240, .45); color: var(--ink); }
.cal span.today { box-shadow: inset 0 0 0 1px var(--accent); }
.cal span.future { opacity: .4; }
.crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--muted); font-size: 15px; margin: 0 0 10px; }
.crumb .btn { padding: 4px 14px; font-size: 14px; }
