/* Карта тем программы (www/topicmap.html, js/topicmap-page.js, решение 0215) */
.topicmap-page main { display: flex; flex-direction: column; gap: 10px; padding-bottom: 40px; }
.topicmap-page.tm-panel-open main { padding-right: 372px; }
.tm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tm-hint, .tm-legend, .tm-count { margin: 0 2px; font-size: .85rem; }
.tm-tools { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.tm-search { flex: 1 1 240px; max-width: 420px; }
.tm-search input { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); }
.tm-check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; font-size: .95rem; }
.tm-check input { width: 18px; height: 18px; }
.tm-btns { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.tm-btns .btn { padding: 7px 12px; font-size: .88rem; }
.topicmap-page :focus-visible { outline: 2px solid #5ba3f5; outline-offset: 2px; }

.tm-cols { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 12px; scrollbar-width: thin; }
.tm-col { flex: 0 0 272px; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-colh { margin: 0 2px; font-size: 1rem; position: sticky; left: 0; }
.tm-colh small { font-weight: 400; color: var(--muted); }
.tm-course { border: 1px solid var(--line); border-radius: 12px; background: var(--card); overflow: hidden; }
.tm-course > h3 { margin: 0; font-size: .92rem; font-weight: 600; }
.tm-ch { display: flex; gap: 8px; align-items: baseline; width: 100%; text-align: left; font: inherit; font-weight: 600; font-size: .9rem; padding: 9px 10px; border: 0; background: transparent; color: var(--text); cursor: pointer; }
.tm-ch:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.tm-chev { flex: none; width: 1em; color: var(--muted); transition: transform .12s; }
.tm-ch[aria-expanded="true"] .tm-chev { transform: rotate(90deg); }
.tm-ct { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tm-cc { flex: none; font-weight: 400; font-size: .78rem; color: var(--muted); }
.tm-cb { padding: 0 6px 8px; }
.tm-bl { margin: 8px 4px 3px; font-size: .74rem; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.tm-t { display: flex; gap: 6px; align-items: baseline; width: 100%; text-align: left; font: inherit; font-size: .86rem; line-height: 1.3; padding: 5px 7px; margin: 1px 0; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; }
.tm-t:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.tm-m { flex: none; width: 1.1em; text-align: center; color: var(--muted); }
.tm-t.st-done .tm-m { color: var(--ok); font-weight: 700; }
.tm-t.st-next .tm-m { color: #c77a12; }
.tm-tt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tm-x { flex: none; font-size: .8rem; color: #5b8fd6; }
/* Выбранная тема и её связи: рамка и значок, не только цвет. */
.tm-has-sel .tm-t:not(.sel):not(.up):not(.down) { opacity: .72; }
.tm-t.sel { background: var(--text); color: var(--bg); border-color: var(--text); opacity: 1; }
.tm-t.sel .tm-m, .tm-t.sel .tm-x { color: inherit; }
.tm-t.up { border-color: #3f86d9; background: color-mix(in srgb, #3f86d9 18%, transparent); opacity: 1; }
.tm-t.down { border-color: #d98a2b; background: color-mix(in srgb, #d98a2b 20%, transparent); border-style: dashed; opacity: 1; }
.tm-t.up::before { content: "←"; flex: none; color: #3f86d9; font-weight: 700; }
.tm-t.down::before { content: "→"; flex: none; color: #c77a12; font-weight: 700; }
.tm-empty { margin: 8px 4px; font-size: .85rem; }
.tm-lg-up, .tm-lg-down { padding: 0 6px; border-radius: 6px; border: 1px solid; }
.tm-lg-up { border-color: #3f86d9; }
.tm-lg-down { border-color: #d98a2b; border-style: dashed; }

/* Панель связей: справа на широком экране, нижняя шторка на телефоне. */
.tm-panel { position: fixed; z-index: 20; top: 64px; right: 12px; bottom: 12px; width: 348px; overflow-y: auto; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 8px 28px rgba(0,0,0,.28); }
.tm-panel[hidden] { display: none; }
.tm-panel h2 { margin: 0 0 2px; font-size: 1.05rem; padding-right: 36px; overflow-wrap: anywhere; }
.tm-panel h3 { margin: 14px 0 4px; font-size: .9rem; }
.tm-panel p { margin: 4px 0; font-size: .85rem; }
.tm-panel ul { list-style: none; margin: 0; padding: 0; }
.tm-panel li { display: flex; gap: 6px; align-items: baseline; padding: 3px 0; }
.tm-pi { flex: 1; min-width: 0; text-align: left; font: inherit; font-size: .86rem; padding: 4px 6px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); cursor: pointer; overflow-wrap: anywhere; }
.tm-pi:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }
.tm-pi small { color: var(--muted); }
.tm-lnk { flex: none; padding: 4px 6px; color: var(--text); text-decoration: none; border-radius: 8px; border: 1px solid var(--line); font-size: .8rem; }
.tm-lnk:hover { border-color: var(--muted); }
.tm-panel .tm-acts { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.tm-panel .tm-acts a { text-decoration: none; padding: 7px 12px; font-size: .88rem; }
.tm-close { position: absolute; top: 8px; right: 8px; width: 34px; height: 34px; font: inherit; font-size: 1.2rem; line-height: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); cursor: pointer; }

@media (max-width: 899px) {
  .topicmap-page.tm-panel-open main { padding-right: 16px; padding-bottom: 56vh; }
  .tm-panel { top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 52vh; border-radius: 16px 16px 0 0; padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
}
@media (max-width: 760px) {
  .tm-cols { display: block; overflow: visible; }
  .tm-col { margin-bottom: 14px; }
  .tm-search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { .tm-chev { transition: none; } }
/* Пункт легенды — целым куском: на телефоне подпись в рамке не рвётся на две строки (2026-10-27). */
.tm-legend { line-height: 1.9; }
.tm-lg-up, .tm-lg-down { display: inline-block; white-space: nowrap; max-width: 100%; }
/* Карта — во всю ширину экрана: колонок десятки, узкая колонка сайта (max-width) прятала их в прокрутку (2026-10-27). */
.topicmap-page .top, .topicmap-page main { max-width: none; }
@media (min-width: 900px) { .topicmap-page .top, .topicmap-page main { padding-left: 24px; padding-right: 24px; } .topicmap-page.tm-panel-open main { padding-right: 384px; } }

/* Схема выбранной темы (2026-10-27): слева «Сначала изучи», центр — тема, справа «Пригодится дальше». */
.topicmap-page.tm-panel-open main { padding-right: 16px; }
@media (min-width: 900px) { .topicmap-page.tm-panel-open main { padding-right: 24px; } }
.tm-focus[hidden] { display: none; }
.tm-focus { border: 1px solid var(--line); border-radius: 14px; background: var(--card); padding: 12px 14px 16px; scroll-margin-top: 8px; }
.tm-ftop { display: flex; justify-content: space-between; align-items: center; min-height: 36px; }
.tm-ftop .btn { padding: 6px 12px; font-size: .88rem; }
.tm-ftop [hidden] { display: none; }
.tm-focus .tm-close { position: static; margin-left: auto; }
.tm-fgrid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 340px) minmax(0, 1fr); gap: 56px; align-items: center; margin-top: 6px; color: #5b8fd6; }
.tm-svg { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.tm-svg path { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .75; }
.tm-svg marker path { fill: currentColor; stroke: none; opacity: 1; }
.tm-fside, .tm-fmid { position: relative; z-index: 1; min-width: 0; color: var(--text); }
.tm-fside h3 { margin: 0 0 8px; font-size: .95rem; }
.tm-fup h3 { color: #3f86d9; }
.tm-fdown h3 { color: #c77a12; }
.tm-fside h3 small { font-weight: 400; color: var(--muted); }
.tm-fside ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tm-none { margin: 0; color: var(--muted); font-size: .9rem; }
.tm-fc { display: block; width: 100%; text-align: left; font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-left: 4px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text); cursor: pointer; }
.tm-fc:hover { border-color: var(--muted); }
.tm-fc-x { border-left-color: hsl(var(--h) 60% 52%); }
.tm-fc-t { display: block; font-size: .9rem; line-height: 1.3; overflow-wrap: anywhere; }
.tm-fc-c { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; margin-top: 3px; font-size: .75rem; color: var(--muted); }
.tm-fc-b { padding: 0 6px; border-radius: 6px; background: hsl(var(--h) 60% 52% / .22); color: var(--text); }
.tm-m.ok { color: var(--ok); font-weight: 700; }
.tm-fcenter { padding: 16px; border: 2px solid hsl(var(--h) 60% 52%); border-radius: 14px; background: var(--bg); text-align: center; }
.tm-fcenter:focus-visible { outline-offset: 3px; }
.tm-fcenter h2 { margin: 0 0 4px; font-size: 1.25rem; overflow-wrap: anywhere; }
.tm-fcenter p { margin: 0; font-size: .85rem; color: var(--muted); }
.tm-fcenter .tm-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 12px; }
.tm-fcenter .tm-acts a { text-decoration: none; padding: 7px 12px; font-size: .88rem; }
/* В колонках: несвязанные темы приглушены, связанные помечены теми же двумя словами. */
.tm-has-sel .tm-t:not(.sel):not(.up):not(.down) { opacity: .4; }
.tm-tag { flex: none; align-self: center; font-size: .66rem; line-height: 1.5; padding: 0 5px; border-radius: 5px; border: 1px solid; white-space: nowrap; }
.tm-tag-up { color: #3f86d9; border-color: #3f86d9; }
.tm-tag-down { color: #c77a12; border-color: #c77a12; }
.tm-t.up::before, .tm-t.down::before { content: none; }
.tm-t.down { border-style: solid; }
@media (max-width: 899px) {
  .tm-fgrid { grid-template-columns: 1fr; gap: 0; }
  .tm-svg { display: none; }
  .tm-fup::after, .tm-fmid::after { content: "↓"; display: block; text-align: center; font-size: 1.6rem; line-height: 1.6; color: #5b8fd6; font-weight: 700; }
  .tm-fup h3, .tm-fdown h3, .tm-fup .tm-none, .tm-fdown .tm-none { text-align: center; }
}
@media (prefers-color-scheme: dark) { .tm-fup h3, .tm-tag-up { color: #6aa8f0; } }
/* Метка «Сначала изучи / Пригодится дальше» — под названием, не сжимает его (2026-10-27). */
.tm-t { flex-wrap: wrap; }
.tm-t .tm-tag { order: 10; flex-basis: auto; margin-left: calc(1.1em + 6px); align-self: flex-start; }
.tm-t .tm-tt { flex: 1 1 0; min-width: 0; }
.tm-t:has(.tm-tag) .tm-tt { flex-basis: calc(100% - 3.5em); }
