/* Строймех PRO — вариант «Чертёжный стол».
   Layout: одна колонка до 560px; схема — главный холст, под ней панель инструментов
   и карточка выбранного элемента. Тема одна — чёрная с салатовым, независимо от темы Telegram. */
:root {
  --bg: #050605;
  --panel: #0F120F;
  --panel-2: #161A16;
  --canvas: #0B0D0B;
  --line: #1C221C;
  --line-2: #2A332A;
  --fg: #EEF5EC;
  --fg-2: #C9D3C9;
  --muted: #8A968A;
  --dim: #5E695E;
  --lime: #B8F04A;
  --lime-ink: #0B1200;
  --lime-soft: rgb(184 240 74 / 0.1);
  --green: #34C77B;
  --teal: #5CC8E6;
  --coral: #FF8A5B;
  --c-M: var(--lime);
  --c-Q: var(--green);
  --c-N: var(--teal);
  --c-react: var(--lime);
  --c-tens: var(--green);
  --c-comp: var(--coral);
  --c-load: var(--fg-2);

  --f-display: 'Unbounded', 'Manrope', system-ui, sans-serif;
  --f-ui: 'Manrope', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.45 var(--f-ui); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.app { max-width: 560px; margin: 0 auto; padding-inline: 16px; padding-block: 12px 24px; }
main { display: flex; flex-direction: column; gap: 12px; }
#calc { display: flex; flex-direction: column; gap: 12px; }
#calc[hidden] { display: none; }
.muted { color: var(--muted); font-size: 13px; }

/* шапка */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-inline: 4px; }
.type-btn { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0; color: var(--fg); }
.type-btn span { font: 700 24px/1.1 var(--f-display); letter-spacing: -0.01em; }
.type-btn svg { color: var(--muted); }
.pill { border: 1px solid var(--lime); background: transparent; color: var(--lime); border-radius: 999px; padding: 6px 12px; font: 500 11px/1.2 var(--f-display); white-space: nowrap; }
.pill.on { background: var(--lime); color: var(--lime-ink); }
.banner { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.banner.warn { border-color: var(--coral); color: var(--fg); }

/* шаблоны */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--line-2); background: transparent; color: var(--fg-2); border-radius: 999px; padding: 7px 13px; font-size: 13px; white-space: nowrap; }
.chip:hover { border-color: var(--lime); color: var(--fg); }
.chip[aria-pressed='true'] { background: var(--lime); color: var(--lime-ink); border-color: var(--lime); font-weight: 700; }
.chip.aux { border-style: dashed; }

/* холст со схемой */
.canvas { border-radius: var(--r-lg); border: 1px solid var(--line); background-color: var(--canvas); background-image: radial-gradient(#1F271F 1.2px, transparent 1.2px); background-size: 16px 16px; padding: 10px 2px 2px; }
.canvas-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 0 12px; font-size: 12px; color: var(--muted); }
.degree { font: 600 11px/1 var(--f-mono); color: var(--green); white-space: nowrap; }
.degree.bad { color: var(--coral); }
#preview svg, .scheme-card svg, .diag-body svg { display: block; width: 100%; height: auto; }

/* панель инструментов */
.tools { display: grid; grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 6px; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 0 8px; border: 0; border-radius: 14px; background: var(--panel); color: var(--fg); min-height: 58px; }
.tool span { font-size: 11px; color: var(--muted); }
.tool:hover, .tool:active { background: var(--panel-2); }
.tool:hover span { color: var(--fg-2); }

/* карточка выбранного элемента */
.insp-card { border-radius: var(--r-lg); background: var(--panel); border: 1px solid var(--line-2); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.insp-card.selected { border-color: var(--lime); }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 36px; }
.insp-title { display: flex; align-items: center; gap: 10px; font: 500 15px/1.2 var(--f-display); }
.insp-title .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--lime); flex: none; }
.insp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.insp-note { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted); }
.fld { display: flex; flex-direction: column; gap: 5px; padding: 9px 12px; border-radius: 14px; background: var(--panel-2); min-width: 0; border: 1px solid transparent; }
.fld.wide { grid-column: 1 / -1; padding: 9px 12px 10px; }
.fld.bad { border-color: var(--coral); }
.fld-l { font-size: 11.5px; color: var(--muted); }
.num-in { border: 0; background: transparent; color: var(--fg); font: 600 20px/1.2 var(--f-mono); padding: 0; width: 100%; min-width: 0; outline: none; }
.sel-in { border: 0; background: transparent; color: var(--fg); font: 600 16px/1.3 var(--f-ui); padding: 2px 0; width: 100%; min-width: 0; outline: none; }
.sel-in option { background: var(--panel-2); color: var(--fg); }
.fld:focus-within { border-color: var(--line-2); }
.segc { display: flex; gap: 4px; padding: 3px; border-radius: 12px; background: var(--bg); }
.segc button { flex: 1; border: 0; border-radius: 9px; padding: 9px 4px; background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; white-space: nowrap; }
.segc button[aria-checked='true'] { background: var(--lime); color: var(--lime-ink); font-weight: 700; }
.el-chips { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }
.el-chip { border: 1px solid var(--line-2); background: var(--bg); color: var(--fg); border-radius: 10px; padding: 7px 11px; font-size: 13px; }
.el-chip:hover { border-color: var(--lime); }
.icon-btn { flex: none; width: 36px; height: 36px; border: 0; border-radius: 10px; background: var(--panel-2); color: var(--muted); display: grid; place-items: center; }
.icon-btn:hover { color: var(--coral); }
.icon-btn svg { width: 18px; height: 18px; }

/* кнопки */
.btn-main { width: 100%; height: 58px; border: 0; border-radius: 18px; background: var(--lime); color: var(--lime-ink); font: 700 16px/1 var(--f-display); display: flex; align-items: center; justify-content: center; gap: 10px; }
.btn-main:disabled { opacity: .6; }
.btn-line { height: 46px; border-radius: 14px; border: 1px solid var(--lime); background: transparent; color: var(--lime); font-weight: 700; font-size: 15px; }
.btn-line.wide { grid-column: 1 / -1; }
.btn-ghost { height: 56px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-2); background: transparent; color: var(--fg); font-weight: 600; }
.solve-bar { position: sticky; bottom: 0; padding-block: 10px calc(10px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.link-btn { align-self: flex-start; border: 0; background: none; padding: 2px 0; color: var(--lime); font-size: 13px; font-weight: 700; }

/* экран решения */
.res-top { display: flex; align-items: center; gap: 12px; padding-inline: 4px; }
.back-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: var(--panel); color: var(--fg); display: grid; place-items: center; flex: none; }
.res-title { margin: 0; font: 700 24px/1.1 var(--f-display); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; padding-inline: 4px; font-size: 12px; }
.tag { padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--fg-2); }
.tag.hot { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); font-weight: 700; }
.scheme-card { border-radius: var(--r-lg); border: 1px solid var(--line); background-color: var(--canvas); background-image: radial-gradient(#1F271F 1.2px, transparent 1.2px); background-size: 16px 16px; padding: 6px 2px 2px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpi { padding: 12px 14px; border-radius: 18px; background: var(--panel); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font: 600 22px/1.25 var(--f-mono); }
.kpi .v small { font-size: 12px; color: var(--muted); font-weight: 400; }
.kpi .w { font-size: 11.5px; color: var(--muted); }
.panel { border-radius: var(--r-lg); background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.panel-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.panel-h h3 { margin: 0; font: 500 13px/1.2 var(--f-display); }
.panel-h span { font-size: 12px; color: var(--muted); }
.reacts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; font-family: var(--f-mono); font-size: 14px; }
.reacts div { display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line-2); padding: 5px 0; min-width: 0; }
.reacts .k { color: var(--muted); }
.reacts .v { white-space: nowrap; }
.diag-body { display: flex; flex-direction: column; gap: 2px; }
.fine { margin: 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 6px; border-bottom: 1px solid var(--line); }
.tbl .num { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.state { font-size: 12px; font-weight: 700; }
.state.tens { color: var(--c-tens); }
.state.comp { color: var(--c-comp); }
.state.zero { color: var(--muted); }

.paywall { border: 1px solid var(--lime); }
.paywall p { margin: 0; color: var(--fg-2); }
.ref-box { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px dashed var(--line-2); }
.ref-box .btn-line { width: 100%; }
.lock svg { width: 26px; height: 26px; fill: none; stroke: var(--lime); stroke-width: 2; }

.steps-h { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 4px 0; }
.steps-h h3 { margin: 0; font: 700 18px/1.2 var(--f-display); }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.step { border-radius: var(--r-md); background: var(--panel); border: 1px solid transparent; }
.step.open { border-color: #2E3A1C; }
.step-h { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 14px; border: 0; background: none; text-align: left; color: var(--fg); }
.step-n { font: 400 12px/1 var(--f-mono); color: var(--dim); min-width: 18px; }
.step.open .step-n { color: var(--lime); }
.step-t { flex: 1; font-size: 14.5px; font-weight: 600; }
.step-h svg { color: var(--muted); transition: transform .15s; flex: none; }
.step.open .step-h svg { transform: rotate(180deg); color: var(--lime); }
.step-b { display: flex; flex-direction: column; gap: 8px; padding: 0 14px 14px; min-width: 0; }
.ln-t { font-size: 13.5px; color: var(--muted); }
.ln-eq { font: 12.5px/1.65 var(--f-mono); background: var(--bg); border-radius: 10px; padding: 8px 11px; overflow-wrap: anywhere; color: var(--fg-2); }
.ln-res { font: 600 13px/1.6 var(--f-mono); color: var(--lime); padding: 0 11px; overflow-wrap: anywhere; }
.ln-ok { font: 12.5px/1.6 var(--f-mono); padding: 4px 11px; border-left: 2px solid var(--green); color: var(--green); overflow-wrap: anywhere; }
.ln-bad { font: 12.5px/1.6 var(--f-mono); padding: 4px 11px; border-left: 2px solid var(--coral); color: var(--coral); overflow-wrap: anywhere; }
.ln-sub { margin: 6px 0 0; font: 600 12px var(--f-display); color: var(--muted); }
.eq-row { display: block; }
.eq-row.ind { padding-left: 1.4em; }
.eq-row + .eq-row { margin-top: 1px; }
sub, sup { font-size: .72em; line-height: 0; }
.step.locked .step-t { color: var(--muted); }
.ghost { display: flex; flex-direction: column; gap: 6px; padding: 0 14px 14px; }
.ghost i { display: block; height: 9px; border-radius: 4px; background: var(--panel-2); }
.ghost i:nth-child(1) { width: 92%; }
.ghost i:nth-child(2) { width: 70%; }
.res-actions { display: flex; gap: 8px; padding-top: 4px; }
.res-actions .btn-main { flex: 1; font-size: 14px; }

/* код активации */
.code-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.code-form .btn-line { height: auto; padding: 0 16px; }
.code-form .num-in::placeholder { color: var(--dim); }

/* шторки */
.sheet { position: fixed; inset: 0; background: rgb(0 0 0 / .6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet-card { width: 100%; max-width: 560px; background: var(--panel); border-top: 1px solid var(--line-2); border-radius: 22px 22px 0 0; padding: 18px 16px calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 12px; }
.sheet-h { margin: 0; font: 700 20px/1.2 var(--f-display); }
.sheet-card p { margin: 0; color: var(--fg-2); }
.status.on { color: var(--lime); font-weight: 700; }
.perks { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; color: var(--fg-2); }
.type-opt { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 16px; border: 1px solid var(--line-2); background: var(--bg); color: var(--fg); text-align: left; }
.type-opt[aria-current='true'] { border-color: var(--lime); background: var(--lime-soft); }
.type-opt b { display: block; font: 500 15px/1.3 var(--f-display); }
.type-opt small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.type-opt svg { flex: none; color: var(--lime); }

.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: min(92vw, 520px); background: var(--fg); color: var(--bg); padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600; z-index: 30; }
.copy-fallback { position: fixed; left: -9999px; top: 0; }

/* ───── SVG: схема ───── */
svg text { font-family: var(--f-mono); font-size: 11px; fill: var(--fg); }
.member { stroke: var(--fg); stroke-width: 3.2; stroke-linecap: round; }
.bar { stroke: var(--fg-2); stroke-width: 2; stroke-linecap: round; }
.bar.tens { stroke: var(--c-tens); stroke-width: 2.6; }
.bar.comp { stroke: var(--c-comp); stroke-width: 2.6; }
.bar.zero { stroke: var(--dim); stroke-dasharray: 4 3; }
.tnode { fill: var(--fg); }
.sup { fill: var(--canvas); stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; }
.sup-base { stroke: var(--muted); stroke-width: 1.6; }
.sup-base.thick { stroke-width: 3; }
.hatch line { stroke: var(--muted); stroke-width: .9; }
.pin, .hinge { fill: var(--canvas); stroke: var(--fg-2); stroke-width: 1.5; }
.load line, .load path, .qline { stroke: var(--c-load); stroke-width: 1.5; fill: none; }
.load polygon { fill: var(--c-load); }
.qarrow line { stroke-width: 1.1; }
.react line, .react path { stroke: var(--c-react); stroke-width: 2.2; fill: none; }
.react polygon { fill: var(--c-react); }
svg .lbl { font-size: 11.5px; }
svg .load-lbl { fill: var(--fg-2); }
svg .react-lbl { fill: var(--c-react); font-weight: 600; }
svg .node-lbl { font-family: var(--f-display); font-weight: 500; font-size: 11.5px; fill: var(--muted); }
svg .sub { font-size: 8.5px; }
svg .halo { paint-order: stroke; stroke: var(--canvas); stroke-width: 3.5px; stroke-linejoin: round; }
.dim line { stroke: var(--line-2); stroke-width: 1; }
.dim .tick { stroke: var(--muted); stroke-width: 1.3; }
svg .dim-lbl { fill: var(--muted); font-size: 10.5px; }
svg .nlbl { font-size: 10px; font-weight: 600; }
svg .nlbl.tens { fill: var(--c-tens); }
svg .nlbl.comp { fill: var(--c-comp); }
svg .nlbl.zero { fill: var(--dim); }

/* сечения и поэтажная схема */
.section line { stroke: var(--teal); stroke-width: 1.6; }
svg .sec-lbl { fill: var(--teal); font-weight: 600; font-size: 12px; }
.floor { stroke: var(--fg-2); stroke-width: 3.2; stroke-linecap: round; }
.floor.main { stroke: var(--fg); }
.floor-pin path, .floor-pin circle { fill: var(--canvas); stroke: var(--lime); stroke-width: 1.5; }
.floor-pin line { stroke: var(--lime); stroke-width: 1.3; stroke-dasharray: 3 3; }
svg .floor-lbl { font-family: var(--f-ui); font-size: 11px; fill: var(--muted); }
.ln-pre { font: 12px/1.55 var(--f-mono); background: var(--bg); border-radius: 10px; padding: 8px 11px; white-space: pre; overflow-x: auto; color: var(--fg-2); }

/* выбор элементов на схеме */
.selable { cursor: pointer; }
.hit { fill: transparent; stroke: none; pointer-events: all; }
.hit-line { stroke: transparent; stroke-width: 18; pointer-events: stroke; }
.scheme .is-sel line, .scheme .is-sel path, .scheme .is-sel .qline { stroke: var(--lime); }
.scheme .is-sel polygon { fill: var(--lime); }
.scheme .is-sel .sup, .scheme .is-sel .pin, .scheme .is-sel .hinge { stroke: var(--lime); }
.scheme .is-sel .sup-base, .scheme .is-sel .hatch line { stroke: var(--lime); }
.scheme .is-sel text { fill: var(--lime); }
.scheme .is-sel .member, .scheme .is-sel .bar { stroke: var(--lime); }
.node-ring { fill: none; stroke: var(--lime); stroke-width: 2; }
.scheme .hit-line, .scheme .hit { stroke: transparent; fill: transparent; }
.scheme .is-sel .hit-line { stroke: transparent; }

/* ───── SVG: эпюры ───── */
.dg-M { --dc: var(--c-M); }
.dg-Q { --dc: var(--c-Q); }
.dg-N { --dc: var(--c-N); }
.dg-IL { --dc: var(--teal); }
.dg .fill { fill: var(--dc); fill-opacity: .08; }
.dg .ord { stroke: var(--dc); stroke-width: .7; opacity: .75; }
.dg .curve { fill: none; stroke: var(--dc); stroke-width: 2; stroke-linejoin: round; }
.dg .axis { stroke: var(--fg); stroke-width: 1.7; }
.dg .hinge { fill: var(--panel); stroke: var(--fg); stroke-width: 1.4; }
svg .val { font-size: 10.5px; font-weight: 600; fill: var(--dc); font-variant-numeric: tabular-nums; }
svg .val.halo, .dg .halo { stroke: var(--panel); }
svg .sign { font-size: 14px; font-weight: 700; fill: var(--dc); }
svg .dg-title { font-family: var(--f-display); font-size: 11.5px; font-weight: 500; fill: var(--dc); }
svg .hint-lbl { fill: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* метод сечений: отсечённая часть и правило знаков */
.scheme.cut, .scheme.signs { width: 100%; height: auto; display: block; background: var(--canvas); border-radius: 12px; }
.cut-gone { stroke: var(--dim); stroke-width: 2; stroke-dasharray: 5 4; }
.cutf-a line, .cutf-m path { stroke: var(--teal); stroke-width: 1.9; fill: none; }
.cutf-a polygon, .cutf-m polygon { fill: var(--teal); }
svg .cutf-lbl { fill: var(--teal); font-weight: 700; font-size: 12px; }
svg .cutf-x { fill: var(--teal); }
.cut-rot { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 3; }
.cut-fiber { fill: none; stroke: var(--coral); stroke-width: 1.5; stroke-dasharray: 4 3; }
svg .sign-cap { font-family: var(--f-display); font-size: 12px; fill: var(--fg-2); }
.step-fig { margin: 2px 0; }

/* фермы: рисование, линии влияния, механизмы */
.insp-stack { display: flex; flex-direction: column; gap: 12px; }
.el-chip.il { border-color: var(--teal); color: var(--teal); }
.grid-dots circle { fill: #2E3A2E; }
.bar.il { stroke: var(--teal); stroke-width: 3; }
.bar.removed { stroke: var(--coral); stroke-dasharray: 5 4; stroke-width: 2.2; }
.belt-line { stroke: var(--lime); stroke-width: 2; stroke-dasharray: 5 4; opacity: .75; }
.ray { stroke: var(--coral); stroke-width: 1.3; stroke-dasharray: 6 4; }
.mpt { fill: var(--coral); }
.mpt-lbl { fill: var(--coral); font-weight: 700; font-size: 13px; }
.chord-line { fill: none; stroke: var(--teal); stroke-width: 1.2; stroke-dasharray: 2 4; opacity: .9; }
.mech line { stroke: var(--teal); stroke-width: 1.6; stroke-dasharray: 5 3; }
.mech-axis { stroke: var(--dim); stroke-width: 1.4; stroke-dasharray: 4 4; }
.mech-line { fill: none; stroke: var(--teal); stroke-width: 3; stroke-linejoin: round; }
.mech-ord { stroke: var(--teal); stroke-width: .7; opacity: .5; }
.mech-hinge { fill: var(--canvas); stroke: var(--teal); stroke-width: 2; }
.mech-slider line { stroke: var(--teal); stroke-width: 2; }
svg .mech-lbl { fill: var(--teal); font-weight: 700; font-size: 12px; }
.sup-removed { opacity: .25; }
.tool.on { background: var(--lime-soft); outline: 1px solid var(--lime); }
.tool.on span { color: var(--lime); }
.drawbar { display: flex; align-items: center; gap: 8px; padding: 0 10px 6px; font-size: 12px; color: var(--muted); }
.drawbar .grow { flex: 1; min-width: 0; }
.drawbar button { border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); border-radius: 10px; padding: 6px 10px; font: 600 12px var(--f-ui); }
.drawbar button.main { background: var(--lime); color: #0B1200; border-color: var(--lime); }
.method-seg { display: flex; gap: 6px; margin: 0 0 8px; }
.coord-area { width: 100%; min-height: 220px; background: var(--bg); color: var(--fg); border: 1px solid var(--line-2); border-radius: 12px; padding: 10px; font: 13px/1.5 var(--f-mono); resize: vertical; }
.device-lock { border: 1px solid var(--coral); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.device-lock p { margin: 0; font-size: 13px; color: var(--muted); }
.bad-text { color: var(--coral); }

/* полноэкранный режим Telegram: отступ под системные кнопки Telegram и вырез экрана */
.top-r { display: flex; align-items: center; gap: 8px; }
.top-l { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.subj-btn { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg-2); border-radius: 999px; padding: 4px 10px 4px 9px; font: 600 12px/1.2 var(--f-body, inherit); }
.subj-btn svg { color: var(--muted); }

/* предметы: приветствие, выбор, «ключ», «скоро» */
.welcome { position: fixed; inset: 0; z-index: 30; background: var(--bg); overflow-y: auto; padding: calc(28px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 16px; max-width: 560px; margin: 0 auto; }
.welcome h1 { margin: 0; font: 700 26px/1.15 var(--f-display); letter-spacing: -0.01em; }
.welcome p { margin: 0; color: var(--fg-2); }
.gift { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 16px; background: var(--lime-soft); border: 1px solid var(--lime); color: var(--fg); font-weight: 600; }
.gift b { color: var(--lime); }
.subj-list { display: flex; flex-direction: column; gap: 10px; }
.subj-opt { display: flex; align-items: center; gap: 14px; padding: 16px 14px; border-radius: 18px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg); text-align: left; width: 100%; }
.subj-opt[aria-current='true'] { border-color: var(--lime); background: var(--lime-soft); }
.subj-opt .ico { font-size: 26px; line-height: 1; flex: none; width: 34px; text-align: center; }
.subj-opt b { display: block; font: 600 16px/1.25 var(--f-display); }
.subj-opt small { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.subj-opt .st { margin-left: auto; flex: none; font: 600 11px/1.2 var(--f-display); color: var(--lime); text-align: right; }
.subj-opt .st.soon { color: var(--muted); }
.subj-opt .st.pro { color: var(--lime-ink); background: var(--lime); border-radius: 999px; padding: 4px 8px; }
.gate { border-radius: var(--r-lg); background: var(--panel); padding: 18px 16px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line-2); }
.gate h2 { margin: 0; font: 700 20px/1.2 var(--f-display); }
.gate p { margin: 0; color: var(--fg-2); }
.gate .big-ico { font-size: 34px; line-height: 1; }
.gate .soon-list { margin: 0; padding-left: 18px; color: var(--fg-2); display: flex; flex-direction: column; gap: 4px; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel); color: var(--fg-2); padding: 0; }
.icon-btn:hover, .icon-btn[aria-pressed='true'] { border-color: var(--lime); color: var(--lime); }
html.tg-fs .app { padding-top: calc(12px + var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)); padding-bottom: calc(24px + var(--tg-safe-area-inset-bottom, 0px)); }

/* ───── сопромат: сечения, стержни, формы ───── */
.sopsec { display: block; width: 100%; height: auto; }
#preview .sopsec, #preview .sop-rod, #preview .sop-col { margin-top: 2px; }
.sec-part { fill: rgb(184 240 74 / .14); stroke: var(--fg); stroke-width: 1.6; stroke-linejoin: round; }
.sec-edge { fill: none; stroke: var(--fg-2); stroke-width: .8; opacity: .55; }
.sec-hole { fill: var(--canvas); stroke: var(--fg); stroke-width: 1.4; stroke-dasharray: 4 3; }
.sec-axis { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 8 3 2 3; }
.sec-axis-h { fill: var(--muted); }
.sec-paxis { stroke: var(--teal); stroke-width: 1.2; stroke-dasharray: 8 3 2 3; }
.sec-paxis-h { fill: var(--teal); }
svg .sec-ax-lbl { fill: var(--fg-2); font-size: 11px; }
.sec-c { fill: var(--lime); }
svg .sec-c-lbl { fill: var(--lime); font-weight: 700; font-size: 12px; }
.sec-vtx { fill: var(--teal); }
svg .sec-vtx-lbl { fill: var(--teal); font-size: 10px; font-weight: 600; }
.sec-core { fill: rgb(92 200 230 / .22); stroke: var(--teal); stroke-width: 1.5; }
.sec-core-pt { fill: var(--teal); }
.nl-line { stroke: var(--coral); stroke-width: 1.6; stroke-dasharray: 10 4; }
svg .nl-lbl { fill: var(--coral); font-size: 10.5px; font-weight: 600; }
.sig-t { fill: rgb(52 199 123 / .28); stroke: var(--c-tens); stroke-width: 1.4; }
.sig-c { fill: rgb(255 138 91 / .26); stroke: var(--c-comp); stroke-width: 1.4; }
.sig-base { stroke: var(--fg-2); stroke-width: 1.4; }
.sig-proj { stroke: var(--dim); stroke-width: .8; stroke-dasharray: 2 3; }
svg .sig-val { font-size: 10.5px; font-weight: 700; }
svg .sig-val.tens, svg .sec-danger-lbl.tens { fill: var(--c-tens); }
svg .sig-val.comp { fill: var(--c-comp); }
.sec-danger.tens { fill: var(--c-tens); }
.sec-danger.comp { fill: var(--c-comp); }
svg .sec-danger-lbl { fill: var(--fg); font-weight: 700; font-size: 12px; }
.sec-force line { stroke: var(--lime); stroke-width: 1.8; }
.sec-force circle { fill: none; stroke: var(--lime); stroke-width: 1.4; }
svg .sec-force-lbl { fill: var(--lime); font-weight: 700; }
.rod-face { fill: rgb(184 240 74 / .1); stroke: var(--fg); stroke-width: 1.6; }
.rod-top, .rod-end { fill: rgb(184 240 74 / .05); stroke: var(--fg-2); stroke-width: 1.2; }
.axis-g line { stroke: var(--muted); stroke-width: 1.2; }
.axis-g polygon { fill: var(--muted); }
svg .ax-lbl { fill: var(--muted); font-size: 11px; }
.buckle { fill: none; stroke: var(--teal); stroke-width: 1.6; stroke-dasharray: 5 4; }
.shape-chips { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.shape-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--fg); min-width: 0; }
.shape-chip b { font: 600 15px/1.1 var(--f-mono); }
.shape-chip small { font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.shape-chip[aria-checked='true'] { border-color: var(--lime); background: var(--lime-soft); }
.shape-chip[aria-checked='true'] b { color: var(--lime); }
.scheme-chips { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.scheme-chip { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--bg); color: var(--fg-2); min-width: 0; }
.scheme-chip b { font: 600 12px var(--f-mono); color: var(--fg); }
.scheme-chip small { font-size: 9.5px; color: var(--muted); text-align: center; line-height: 1.15; }
.scheme-chip .mini { color: var(--fg-2); }
.scheme-chip[aria-pressed='true'] { border-color: var(--lime); background: var(--lime-soft); }
.scheme-chip[aria-pressed='true'] .mini, .scheme-chip[aria-pressed='true'] b { color: var(--lime); }
.el-chip.on { border-color: var(--lime); color: var(--lime); background: var(--lime-soft); }
.part-card { grid-column: 1 / -1; border: 1px solid var(--line-2); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.part-h { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.part-h .link-btn { padding: 0; }
.type-btn span.long { font-size: 18px; }

/* разведение подписей: линия-выноска к отодвинутой подписи; широкие схемы — с прокруткой вбок */
.dc-leader { stroke: var(--dim); stroke-width: .8; stroke-dasharray: 2 2; pointer-events: none; }
.scheme-card { overflow-x: auto; overscroll-behavior-x: contain; }
.scheme-card.scrollable::after { content: '← листайте схему вбок →'; display: block; text-align: center; font-size: 11.5px; color: var(--muted); padding: 2px 0 6px; position: sticky; left: 0; }
.axis-line { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 8 3 2 3; }
.mom-arc { fill: none; stroke: var(--c-load); stroke-width: 1.6; }
.mom-head { fill: var(--c-load); }

/* решение в PDF */
.pdf-panel { display: flex; flex-direction: column; gap: 10px; }
.pdf-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.pdf-btn[disabled] { opacity: .7; }

/* тарифы: пакеты на несколько предметов и тарифы «скоро» */
.multi-plans { border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.multi-plans summary { cursor: pointer; font: 600 14px/1.3 var(--f-ui); color: var(--lime); list-style: none; }
.multi-plans summary::-webkit-details-marker { display: none; }
.multi-plans[open] summary { margin-bottom: 8px; }
.multi-plans > button + button { margin-top: 8px; }
.btn-line.soon, .btn-main.soon { opacity: .55; }
.multi-plans button { width: 100%; }
