/* gmyrya // terminal — олдскульный CRT: янтарь по умолчанию, фосфор как альтернатива.
   Тот же фон #0A0B0E, что у всего сайта. Ноль внешних зависимостей. */

@font-face {
  font-family: 'JetBrains Mono Variable';
  src: url('jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: 'JetBrains Mono Variable';
  src: url('jetbrains-mono-cyrillic-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
  unicode-range: U+0400-04FF;
}

:root {
  /* фон и панели — токены сайта (--bg, --bg-2), линии — бронза сайта */
  --bg: #0a0b0e;
  --panel: #101217;
  --fg: #ffb000;      /* янтарь: значения, вердикты, акценты */
  --text: #f2dcae;    /* проза: тёплый крем между янтарём и --ink сайта, глаз не устаёт */
  --dim: #b08a4a;     /* подписи: янтарь, уведённый в --bronze сайта (6:1, AA) */
  --faint: #6b5530;   /* декор: рамки-глифы, разделители */
  --line: rgba(214, 176, 122, 0.26);
  --line-soft: rgba(214, 176, 122, 0.11);
  --glow: rgba(255, 176, 0, 0.07);
  --alert: #ff5544;
  --sel: rgba(255, 176, 0, 0.25);
  --focus: #5b8cff;   /* синий сайта — фокус и выделение, как на главной */
}
body.theme-green {
  --fg: #33ff66;
  --text: #c9f5d4;
  --dim: #5aa872;
  --faint: #2a5c3a;
  --line: rgba(51, 255, 102, 0.24);
  --line-soft: rgba(51, 255, 102, 0.1);
  --glow: rgba(51, 255, 102, 0.06);
  --sel: rgba(51, 255, 102, 0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; } /* явные display у .boot/.help не должны перебивать hidden */
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg) radial-gradient(ellipse 70% 50% at 50% -10%, var(--glow), transparent 70%) no-repeat;
  color: var(--fg);
  font-family: 'JetBrains Mono Variable', ui-monospace, 'Cascadia Mono', 'JetBrains Mono', Consolas, 'Liberation Mono', monospace;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-variant-ligatures: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
::selection { background: var(--sel); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 30; background: var(--bg); padding: 4px 10px; border: 1px solid var(--line); }

/* ---------- шапка BBS ---------- */
.t-head { border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; background: rgba(10, 11, 14, 0.82); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.t-head__row {
  max-width: 1120px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  white-space: nowrap; overflow: hidden;
}
.t-head__brand { font-weight: 700; letter-spacing: 0.04em; }
.t-head__sep { color: var(--faint); }
.t-head__cell { color: var(--dim); }
.t-head__cell b { color: var(--fg); font-weight: 400; }
.cursor { animation: blink 1.1s steps(1) infinite; }

@keyframes blink { 50% { opacity: 0; } }

/* ---------- плашки ---------- */
.banner { max-width: 1120px; margin: 12px auto 0; width: calc(100% - 40px); padding: 8px 14px; border: 1px solid var(--alert); color: var(--alert); }
.banner--crit { animation: none; }

/* ---------- каркас ---------- */
.t-main { max-width: 1120px; margin: 0 auto; padding: 18px 20px 8px; width: 100%; }

.t-sec { min-width: 0; border: 1px solid var(--line-soft); margin-bottom: 14px; background: var(--panel); border-radius: 2px; }

.t-sec__head {
  display: flex; align-items: baseline; gap: 8px;
  padding: 8px 14px; border-bottom: 1px solid var(--line-soft);
  letter-spacing: 0.08em; white-space: nowrap; overflow: hidden;
}
.t-sec__head::before { content: '┌─'; color: var(--faint); }
.t-sec__num { color: var(--dim); }
.t-sec__head h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.08em; }
.t-sec__fill { flex: 1; min-width: 12px; align-self: center; border-bottom: 1px dotted var(--faint); }
.t-sec__hint { color: var(--dim); font-size: 12px; opacity: 0.75; }
.t-sec__verdict { color: var(--fg); }
.t-sec__body { padding: 12px 14px 14px 30px; }

.t-grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.t-grid2 > .t-sec { margin-bottom: 14px; }

.t-text { max-width: 78ch; color: var(--text); }
.t-analog { color: var(--dim); margin-top: 6px; }
.t-analog:empty, .t-text:empty, .t-notes:empty, .t-watch:empty { display: none; }
.t-analog::before { content: '≡ '; color: var(--faint); }
.t-watch { margin-top: 8px; color: var(--dim); }
.t-watch b { color: var(--fg); font-weight: 400; }
.t-notes { margin-top: 8px; color: var(--dim); max-width: 78ch; }
.t-notes li { list-style: none; }
.t-notes li::before, .t-notes span.note::before { content: '» '; color: var(--faint); }
.t-flips { margin-top: 10px; }
.t-flips .flip { color: var(--dim); }
.t-flips .flip b { color: var(--fg); font-weight: 400; }
.t-flips .flip::before { content: '→ до '; color: var(--faint); }

/* ---------- сводка и сценарий ---------- */
.t-sec--lead { border-color: var(--line); }
.t-headline { font-size: 18px; font-weight: 700; color: var(--fg); letter-spacing: 0.02em; margin-bottom: 8px; }
.t-lead { color: var(--dim); font-size: 13px; max-width: 92ch; margin-bottom: 10px; }
.t-meter { color: var(--fg); letter-spacing: 1px; font-size: 12px; }
.t-lines { margin-top: 14px; }
.t-line { display: grid; grid-template-columns: 15ch minmax(0, 1fr) 40px; gap: 12px; padding: 7px 0; border-top: 1px dotted var(--line-soft); align-items: baseline; }
.t-line dt { color: var(--dim); letter-spacing: 0.08em; font-size: 12px; }
.t-line dd { color: var(--text); max-width: 92ch; }
.t-because { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.t-because span { border: 1px solid var(--line-soft); color: var(--dim); font-size: 12px; padding: 1px 8px; }
.t-sub { font-size: 12px; font-weight: 400; color: var(--dim); letter-spacing: 0.14em; margin: 16px 0 6px; }
.t-sub::before { content: '── '; color: var(--faint); }
.t-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }
.t-note { color: var(--text); opacity: 0.85; max-width: 78ch; margin-top: 8px; }
.t-cols .t-note { margin-top: 0; }
.t-trig { list-style: none; }
.t-trig li { padding: 2px 0 2px 2ch; text-indent: -2ch; color: var(--text); }
.t-trig--worse li::before { content: '▼ '; color: var(--alert); }
.t-trig--better li::before { content: '▲ '; color: var(--fg); }

/* ---------- настроение, сектора, мои активы ---------- */
.t-small { font-size: 12px; color: var(--dim); opacity: 1; }
.t-small b { color: var(--fg); font-weight: 400; }
.t-parts { list-style: none; margin: 12px 0 4px; }
.t-parts li { display: grid; grid-template-columns: 4ch 20ch minmax(0, 1fr); gap: 10px; padding: 3px 0; border-top: 1px dotted var(--line-soft); }
.t-parts li:first-child { border-top: none; }
.t-parts__pts { text-align: right; }
.t-parts__label { color: var(--dim); }
.t-parts__note { color: var(--text); opacity: 0.85; }
.t-rot { color: var(--bg); background: var(--fg); padding: 0 6px; font-weight: 400; }
.t-note b { font-weight: 400; }
.t-tbl__row, .t-tbl--theme, .t-tbl__head { display: grid; gap: 4px 12px; align-items: baseline; }
.t-tbl__head { color: var(--dim); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75; padding: 6px 0 4px; }
.t-tbl__row { padding: 5px 0; border-top: 1px dotted var(--line-soft); }
.t-tbl__row small { color: var(--dim); font-size: 11px; }
.t-tbl--sec { margin-top: 10px; }
.t-tbl--sec .t-tbl__row, .t-tbl--sec .t-tbl__head { grid-template-columns: minmax(0, 1.6fr) 72px 72px minmax(0, 1.4fr) 76px; }
.t-tbl--sec .t-tbl__row > span:nth-child(2), .t-tbl--sec .t-tbl__row > span:nth-child(3),
.t-tbl--sec .t-tbl__head > span:nth-child(2), .t-tbl--sec .t-tbl__head > span:nth-child(3) { text-align: right; }
.t-bar { letter-spacing: -1px; font-size: 12px; }
.t-bar.is-up { color: var(--fg); }
.t-bar.is-down { color: var(--alert); }
.t-insights { list-style: none; margin: 4px 0 10px; }
.t-insights li { padding: 4px 0 4px 2ch; text-indent: -2ch; color: var(--text); max-width: 100ch; }
.t-insights li::before { content: '» '; color: var(--faint); }
.t-chip { display: inline-block; border: 1px solid var(--line-soft); padding: 0 7px; margin: 2px 2px 0 0; color: var(--fg); font-size: 12px; cursor: help; }
.t-themes { list-style: none; }
.t-themes > li { border-top: 1px dotted var(--line-soft); }
.t-tbl--theme { grid-template-columns: minmax(0, 1.5fr) 56px 72px 48px minmax(0, 1.3fr); padding: 7px 8px; margin: 0 -8px; }
.t-tbl--theme > span:nth-child(2), .t-tbl--theme > span:nth-child(3), .t-tbl--theme > span:nth-child(4) { text-align: right; }
.t-theme > summary { list-style: none; cursor: pointer; }
.t-theme > summary::-webkit-details-marker { display: none; }
.t-theme > summary:hover, .t-theme[open] > summary { background: var(--line-soft); }
.t-theme__name { color: var(--fg); }
.t-theme__name::before { content: '+ '; color: var(--faint); }
.t-theme[open] .t-theme__name::before { content: '− '; }
.t-theme__name small { color: var(--dim); font-size: 11px; margin-left: 4px; }
.t-tbl--asset { padding: 4px 8px 10px 3ch; margin: 0 -8px; background: var(--line-soft); font-size: 13px; }
.t-tbl--asset .t-tbl__row, .t-tbl--asset .t-tbl__head { grid-template-columns: minmax(0, 1.6fr) 62px 62px 62px 46px 74px minmax(0, 1fr) 40px; }
.t-tbl--asset .t-tbl__row > span:nth-child(n+2):nth-child(-n+6), .t-tbl--asset .t-tbl__head > span:nth-child(n+2):nth-child(-n+6) { text-align: right; }

/* ---------- списки сигналов ---------- */
.t-siglist { list-style: none; }
.t-siglist > li { border-top: 1px dotted var(--line-soft); }
.t-siglist > li:first-child { border-top: none; }

/* строка показателя: <details> — краткая линия + пояснение, клик раскрывает подробности */
.t-sig > summary, .t-sig--head {
  display: grid; grid-template-columns: minmax(150px, 1.25fr) 112px 104px minmax(0, 1fr) 40px;
  gap: 2px 12px; align-items: baseline; padding: 7px 8px; margin: 0 -8px;
}
.t-sig > summary { list-style: none; cursor: pointer; }
.t-sig > summary::-webkit-details-marker { display: none; }
.t-sig > summary:hover, .t-sig[open] > summary { background: var(--line-soft); }
.t-sig--head { color: var(--dim); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.75; padding-top: 0; }
.t-sig__name { color: var(--fg); letter-spacing: 0.02em; }
.t-sig__name::before { content: '+ '; color: var(--faint); }
.t-sig[open] .t-sig__name::before { content: '− '; }
.t-sig__val { text-align: right; white-space: nowrap; color: var(--fg); }
.t-sig__val small { color: var(--dim); }
.t-sig__ch { text-align: right; white-space: nowrap; color: var(--dim); font-size: 13px; }
.t-sig__state { min-width: 0; }
.t-sig__mean { grid-column: 1 / -1; color: var(--text); opacity: 0.78; font-size: 13px; padding-left: 2ch; max-width: 92ch; }
.t-sig__more { padding: 8px 8px 12px 2ch; margin: 0 -8px; background: var(--line-soft); color: var(--text); font-size: 13px; }
.t-sig__more p { max-width: 92ch; margin-top: 6px; }
.t-sig__more p:first-child { margin-top: 0; }
.t-sig__more b { color: var(--fg); font-weight: 400; }
.t-sig__more small { color: var(--dim); }
.t-sig__src { color: var(--dim); }
.t-sig__chart { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.t-sig__spark { color: var(--fg); white-space: nowrap; overflow: hidden; display: inline-flex; max-width: 100%; }
.t-sig__spark i { font-style: normal; flex: none; }
.t-sig__spark i:last-child { text-shadow: 0 0 6px currentColor; }
.t-group { color: var(--dim); font-size: 11px; letter-spacing: 0.14em; padding: 14px 0 4px; border-top: none !important; }
.t-group:first-child { padding-top: 0; }
@media (min-width: 960px) {
  /* половинная колонка (кредит) */
  .t-grid2 .t-sig > summary { grid-template-columns: minmax(0, 1fr) 70px minmax(0, auto) 40px; }
  .t-grid2 .t-sig__ch { display: none; }
}

/* ---------- уровни: цвет + текстовая метка, смысл не только в цвете ---------- */
.lv-ok { color: var(--fg); }
.lv-warn { color: var(--bg); background: var(--fg); padding: 0 4px; }
.lv-alert { color: var(--alert); }
.lv-crit { color: var(--alert); animation: crit 2.2s steps(1) infinite; }
.lv-none { color: var(--dim); }
@keyframes crit { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0.25; } }

.tag { font-size: 12px; letter-spacing: 0; text-align: right; }
.t-sig .tag { justify-self: end; }
.t-siglist + .t-text { margin-top: 12px; padding-top: 10px; border-top: 1px dotted var(--line-soft); }
.tag[data-lv="ok"]::after { content: '[OK]'; }
.tag[data-lv="warn"]::after { content: '[!!]'; }
.tag[data-lv="alert"]::after, .tag[data-lv="crit"]::after { content: '[XX]'; }
.tag[data-lv="none"]::after { content: '[--]'; }
.tag[data-lv=""]::after { content: ''; }

.stale-mark { color: var(--dim); }
.stale-mark::after { content: ' [~~]'; }

/* ---------- рецессия: галочки ---------- */
.t-checks { list-style: none; }
.t-checks li { padding: 3px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-checks .box { display: inline-block; width: 4ch; color: var(--fg); }
.t-checks li.off { color: var(--dim); }
.t-checks li.na { color: var(--faint); }
.t-checks li.na .box { color: var(--faint); }
.t-checks .sub { color: var(--dim); font-size: 12px; }

/* ---------- журнал ---------- */
.t-log { list-style: none; }
.t-log li { padding: 2px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-log .d { color: var(--dim); }
.t-log .arrow { color: var(--faint); }
.t-empty { color: var(--faint); }

/* ---------- футер ---------- */
.t-foot { border-top: 1px solid var(--line); margin-top: auto; }
.t-foot__row { max-width: 1120px; margin: 0 auto; padding: 10px 20px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.t-foot__home { color: var(--dim); }
.t-foot__home:hover { color: var(--fg); }
.t-foot__keys b { color: var(--dim); font-weight: 400; }
.t-foot__keys { color: var(--dim); opacity: 0.7; font-size: 12px; letter-spacing: 0.04em; }
.t-foot__btns { display: none; gap: 8px; margin-left: auto; }
.t-foot__btns button { border: 1px solid var(--line-soft); padding: 4px 10px; color: var(--dim); font-size: 12px; }
.t-foot__btns button:hover { color: var(--fg); border-color: var(--line); }

/* ---------- помощь ---------- */
.help { position: fixed; inset: 0; z-index: 40; background: rgba(10, 11, 14, 0.88); display: flex; align-items: center; justify-content: center; padding: 20px; }
.help__box { max-width: 760px; width: 100%; max-height: 84vh; display: flex; flex-direction: column; border: 1px solid var(--line); background: var(--panel); }
.help__head { padding: 10px 16px; border-bottom: 1px solid var(--line-soft); letter-spacing: 0.1em; color: var(--fg); }
.help__body { overflow: auto; padding: 12px 16px; }
.help__body h3 { font-size: 13px; letter-spacing: 0.08em; color: var(--fg); margin: 14px 0 6px; }
.help__body h3::before { content: '┌─ '; color: var(--faint); }
.help__body h3:first-child { margin-top: 0; }
.help__body dl { margin-bottom: 4px; }
.help__body dt { color: var(--fg); margin-top: 8px; }
.help__body dd { color: var(--text); opacity: 0.8; margin-left: 0; }
.help__body dd.thr { margin-left: 0; }
.help__foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line-soft); color: var(--dim); font-size: 12px; }
#help-close { color: var(--dim); }
#help-close:hover { color: var(--fg); }

/* ---------- загрузочная анимация ---------- */
.boot { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; align-items: flex-start; padding: 48px 40px; }
.boot__lines { font-family: inherit; color: var(--fg); line-height: 1.9; }

/* ---------- CRT-эффекты: сканлайны + свечение, клавиша S ---------- */
body.crt::before {
  content: ''; position: fixed; inset: 0; z-index: 45; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}
body.crt .t-sec__head h2, body.crt .t-head__brand, body.crt .t-sec__verdict {
  text-shadow: 0 0 6px currentColor;
}

/* ---------- ошибка загрузки ---------- */
.t-error { border: 1px solid var(--alert); color: var(--alert); padding: 14px; margin: 18px 20px; }

.noscript { padding: 20px; color: var(--dim); }

/* ---------- мобильная версия ---------- */
@media (max-width: 959px) {
  .t-grid2 { grid-template-columns: minmax(0, 1fr); }
  .t-sig > summary, .t-sig--head { grid-template-columns: minmax(0, 1fr) 100px 90px minmax(0, 1fr) 40px; }
}
@media (max-width: 639px) {
  body { font-size: 13px; }
  .t-head__row { padding: 10px 12px; gap: 8px; }
  .t-head__cell--lag { display: none; }
  .t-main { padding: 12px 10px 6px; }
  .t-sec__body { padding: 10px 10px 12px 18px; }
  .t-foot__keys { display: none; }
  .t-sec__hint { display: none; }
  .t-foot__btns { display: flex; }
  /* две строки: имя · значение · метка / изменение · состояние, ниже пояснение */
  .t-sig--head { display: none; }
  .t-sig > summary { grid-template-columns: minmax(0, 1fr) auto 40px; gap: 2px 8px; }
  .t-sig__name { grid-column: 1; grid-row: 1; }
  .t-sig__val { grid-column: 2; grid-row: 1; }
  .t-sig > summary > .tag { grid-column: 3; grid-row: 1; }
  .t-sig__ch { grid-column: 1; grid-row: 2; text-align: left; padding-left: 2ch; }
  .t-sig__state { grid-column: 2 / -1; grid-row: 2; justify-self: end; text-align: right; }
  .t-sig__mean { grid-row: 3; }
  .t-line { grid-template-columns: minmax(0, 1fr) 40px; gap: 2px 8px; }
  .t-line dt { grid-column: 1; }
  .t-line dd { grid-column: 1 / -1; grid-row: 2; }
  .t-line .tag { grid-column: 2; grid-row: 1; }
  .t-cols { grid-template-columns: minmax(0, 1fr); }
  .t-headline { font-size: 16px; }
  .t-parts li { grid-template-columns: 4ch minmax(0, 1fr); }
  .t-parts__note { grid-column: 2; }
  .t-tbl--sec .t-tbl__row, .t-tbl--sec .t-tbl__head { grid-template-columns: minmax(0, 1fr) 62px 62px; }
  .t-tbl--sec .t-tbl__row > span:nth-child(4) { grid-column: 1 / 3; }
  .t-tbl--sec .t-tbl__row > span:nth-child(5) { text-align: right; }
  .t-tbl--sec .t-tbl__head > span:nth-child(n+4) { display: none; }
  .t-tbl--theme { grid-template-columns: minmax(0, 1fr) 48px 66px 40px; }
  .t-tbl--theme > span:nth-child(5) { grid-column: 1 / -1; font-size: 12px; }
  .t-tbl--theme.t-tbl__head > span:nth-child(5) { display: none; }
  .t-tbl--asset { padding-left: 8px; }
  .t-tbl--asset .t-tbl__row, .t-tbl--asset .t-tbl__head { grid-template-columns: minmax(0, 1fr) 58px 58px 56px; }
  .t-tbl--asset .t-tbl__row > span:nth-child(n+5) { font-size: 12px; color: var(--dim); }
  .t-tbl--asset .t-tbl__row > span:nth-child(5)::before { content: 'бета '; }
  .t-tbl--asset .t-tbl__row > span:nth-child(6)::before { content: 'падения '; }
  .t-tbl--asset .t-tbl__head > span:nth-child(n+5) { display: none; }
  .t-tbl--asset .t-tbl__row > span:nth-child(n+5) { text-align: left !important; white-space: nowrap; }
  .t-tbl--asset .t-tbl__row > span:nth-child(5) { grid-column: 1; padding-left: 1ch; }
  .t-tbl--asset .t-tbl__row > span:nth-child(6) { grid-column: 2 / -1; text-align: right !important; }
  .t-tbl--asset .t-tbl__row > span:nth-child(7) { grid-column: 1 / -1; padding-left: 1ch; }
  .t-tbl--asset .t-tbl__row > span:nth-child(7)::before { content: 'поведение: '; }
  .t-tbl--asset .t-tbl__row > span:nth-child(8) { display: none; }
  /* две строки: имя · значение · метка / спарк · состояние */
}

/* ---------- меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
  .cursor, .lv-crit { animation: none; }
  .boot { display: none !important; }
}
