/* Демо «Как это выглядит» на открытых страницах (landing/demos.mjs, /demo.js): упрощённая копия интерфейса
   приложения на статичном примере. Цвета — те же, что в приложении (src/styles.css): панель #15181e, золото #cfb27c,
   прибыль зелёная #62cea1. Подключается только на стартовой и страницах разделов. Решение сессии 11.10.2026. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.demo-block [hidden] { display: none !important; }
.demo-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.di { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.demo-block button { font: inherit; color: inherit; cursor: pointer; }
.demo-block .green { color: #62cea1; }

/* Окно демо */
.demo { border: 1px solid var(--line); border-radius: 12px; background: #111419; overflow: hidden; }
.demo-bar { display: flex; align-items: center; gap: 12px; padding: 9px 14px; background: var(--panel); border-bottom: 1px solid var(--line); }
.demo-dots { display: inline-flex; gap: 5px; }
.demo-dots i { width: 8px; height: 8px; border-radius: 50%; background: #2c313a; }
.demo-bar-title { display: inline-flex; align-items: center; gap: 7px; color: var(--gold); font-size: 13px; font-weight: 600; }
.demo-body { padding: 16px; }
/* Метка «Пример» в шапке окна: видна сразу, на телефоне тоже — это не сегодняшний рынок. */
.demo-badge { margin-left: auto; padding: 2px 10px; border: 1px solid #8a7038; border-radius: 999px; background: rgba(207, 178, 124, .14); color: var(--gold);
  font-size: 11.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
/* Строка над списком: почему варианты стоят в таком порядке. */
.demo-order { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.demo-player { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-player span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--muted); font-size: 13px; }
.demo-player b { color: #e5e7ea; font-weight: 600; }
.demo-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 12px 0; }
.demo-run { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 0; border-radius: 8px;
  background: var(--gold); color: #17140d; font-size: 14px; font-weight: 650; transition: background .15s; }
.demo-block .demo-run { color: #17140d; }
.demo-run:hover { background: #dcc293; }
.demo-run[aria-busy="true"] { opacity: .7; cursor: progress; }
/* Строка «Ищем… / Готово» — всегда своя строка под кнопкой, место под неё занято заранее: страница не прыгает. */
.demo-status { order: 3; flex: 1 0 100%; min-height: 19px; color: var(--muted); font-size: 12.5px; line-height: 19px; }
.demo-actions .demo-tabs { margin-left: auto; }

/* Список: до нажатия кнопки прикрыт заглушкой того же размера — страница не прыгает */
.demo-results { position: relative; }
.demo-wait { display: none; }
.demo-list { display: grid; gap: 8px; transition: opacity .25s, filter .25s; }
.is-waiting .demo-list { opacity: .16; filter: blur(3px); pointer-events: none; user-select: none; }
.is-waiting .demo-wait { display: block; position: absolute; z-index: 1; top: 56px; left: 50%; transform: translateX(-50%); max-width: 90%; padding: 9px 16px;
  border: 1px solid #6b5a33; border-radius: 999px; background: #1a1812; color: var(--gold); font-size: 13px; text-align: center; }
.is-searching .demo-wait { display: none; }

/* Плашка варианта */
.demo-row { border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.demo-row.large { border-color: #5a4d30; }
.demo-row.medal-silver { border-color: #59606c; background: linear-gradient(125deg, #212328 0%, #191b20 60%); }
.demo-row.medal-bronze { border-color: #66472f; background: linear-gradient(125deg, #241c16 0%, #191b20 60%); }
.demo-medal.medal-silver { background: #c3cad4; }
.demo-medal.medal-bronze { background: #c58a5a; }
.demo-row.medal-gold { border-color: #8a7038; background: linear-gradient(125deg, #2a2516 0%, #1c1d1f 58%); box-shadow: 0 0 0 1px rgba(217, 181, 106, .28), 0 0 26px rgba(217, 181, 106, .13); }
.demo-row summary, .demo-row-body { display: grid; grid-template-columns: 18px 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px 14px; }
.demo-row summary { cursor: pointer; list-style: none; border-radius: 10px; }
.demo-row summary::-webkit-details-marker { display: none; }
.demo-row summary:hover .demo-more { text-decoration: underline; }
.demo-place { color: var(--faint); font-size: 13px; font-variant-numeric: tabular-nums; text-align: center; }
.demo-icon { position: relative; display: inline-flex; }
.demo-item { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex-shrink: 0;
  border: 1px solid #343a45; border-radius: 9px; background: #1d2027; color: #c9b990; }
.demo-item.ench-1 { border-color: #4c8f5f; }
.demo-item.ench-2 { border-color: #4a7fc0; }
.demo-item.ench-3 { border-color: #8a62c4; }
.demo-item.ench-4 { border-color: #c9a23f; }
.demo-item-tier { position: absolute; right: 2px; bottom: 1px; color: #e5e7ea; font-size: 9.5px; font-weight: 650; line-height: 1; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.demo-medal { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%; background: #d9b56a; font-size: 13px; line-height: 1; box-shadow: 0 0 0 2px #1c1d1f; }
.demo-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.demo-main strong { font-size: 15px; font-weight: 620; line-height: 1.3; }
.demo-best { display: inline-flex; align-items: center; gap: 5px; color: var(--gold); font-size: 11.5px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.demo-sub { color: var(--muted); font-size: 12.5px; }
.demo-deal { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
.demo-deal .di { margin-right: 5px; vertical-align: -2px; color: var(--faint); }
.demo-deal b { color: #e5e7ea; font-weight: 600; }
.demo-deal-label { color: #c3c7cf; }
.demo-flag { color: #e2b765; font-size: 12.5px; }
.demo-more { margin-top: 2px; color: var(--gold); font-size: 12.5px; font-weight: 600; }
.demo-more::after { content: ' ▾'; }
details[open] .demo-more::after { content: ' ▴'; }
.demo-figures { display: flex; gap: 18px; }
.demo-figure { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.demo-figure small { color: var(--faint); font-size: 11px; }
.demo-figure b { font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; }
.demo-figure em { color: var(--muted); font-size: 11px; font-style: normal; }
.demo-details { padding: 12px 14px 14px 88px; border-top: 1px solid var(--line); }
.demo-steps { display: grid; gap: 8px; }
.demo-steps li { display: flex; gap: 10px; color: #c3c7cf; font-size: 13.5px; }
.demo-steps b { color: #e5e7ea; font-weight: 600; }
.demo-step-n { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; flex-shrink: 0; border: 1px solid #6b5a33; border-radius: 50%;
  color: var(--gold); font-size: 12px; font-weight: 650; }
.demo-note { margin-top: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.demo-note .di { vertical-align: -2px; color: var(--gold); }
.demo-dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin: 0; }
.demo-dl div { display: flex; flex-direction: column; }
.demo-dl dt { color: var(--faint); font-size: 11.5px; }
.demo-dl dd { margin: 0; font-size: 14px; font-weight: 600; }

/* Вкладки и переключатели */
.demo-tabs, .demo-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.demo-tab, .demo-toggle { display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; transition: border-color .15s, color .15s; }
.demo-block .demo-tab, .demo-block .demo-toggle { color: var(--muted); }
.demo-tab:hover, .demo-toggle:hover { border-color: #6b5a33; }
.demo-block .demo-tab[aria-pressed="true"] { border-color: #8a7038; background: rgba(207, 178, 124, .1); color: var(--gold); }
.demo-tab .demo-item { width: 24px; height: 24px; border-radius: 6px; }
.demo-tab .demo-item-tier { display: none; }
.demo-tabs.compact .demo-tab { min-height: 32px; padding: 3px 11px; font-size: 12.5px; }
.demo-home-tabs { margin-bottom: 14px; }
.demo-home-tabs .demo-tab { min-height: 42px; padding: 8px 16px; font-size: 14px; }
.demo-toggles { margin-top: 12px; }
.demo-toggle i { width: 16px; height: 0; border-top: 3px solid currentColor; }
.demo-block .demo-toggle[aria-pressed="true"] { color: #e5e7ea; }
.demo-toggle[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.demo-toggle.line-0 i, .demo-line.line-0 { color: #cfb27c; stroke: #cfb27c; }
.demo-toggle.line-1 i, .demo-line.line-1 { color: #6ea8fe; stroke: #6ea8fe; }
.demo-toggle.line-2 i, .demo-line.line-2 { color: #62cea1; stroke: #62cea1; }
.demo-toggle.line-1 i { border-top-style: dashed; }
.demo-toggle.line-2 i { border-top-style: dotted; }

/* График */
.demo-chart-title { display: flex; align-items: center; gap: 6px; margin: 14px 0 8px; color: #c3c7cf; font-size: 13px; font-weight: 600; }
.demo-body > .demo-chart-title:first-child { margin-top: 0; }
.demo-chart-title .di { color: var(--gold); }
.demo-charts, .demo-hours-block { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.demo-hours-block { margin-top: 12px; }
.demo-hours-block .demo-chart-title { margin-top: 0; }
.demo-chart, .demo-hours { display: block; width: 100%; height: auto; }
.demo-grid { stroke: #272b33; stroke-width: 1; }
.demo-axis { fill: #7d8593; font-size: 11px; }
.demo-line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
/* Одиночный день между пропусками — точкой (линию из одной точки не провести). */
.demo-dot { stroke: none; }
.demo-dot.line-0 { fill: #cfb27c; }
.demo-dot.line-1 { fill: #6ea8fe; }
.demo-dot.line-2 { fill: #62cea1; }
.demo-line.line-1 { stroke-dasharray: 7 4; }
.demo-line.line-2 { stroke-dasharray: 2 5; }
.bar-down { fill: #2f5747; }
.bar-low { fill: #62cea1; }
.bar-up { fill: #4d4335; }
.demo-hours-axis { display: flex; justify-content: space-between; color: var(--faint); font-size: 11px; }

/* Рынок игроков */
.demo-lot-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.demo-lot-card { display: flex; flex-direction: column; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); text-align: left;
  transition: border-color .15s; }
.demo-lot-card:hover { border-color: #6b5a33; }
.demo-lot-card[aria-pressed="true"] { border-color: #8a7038; box-shadow: 0 0 0 1px rgba(217, 181, 106, .22); }
.demo-lot-head, .demo-lot-title { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; font-size: 14px; }
.demo-seller { color: var(--muted); font-size: 12.5px; }
.demo-online { margin-left: 8px; color: #62cea1; }
.demo-online::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 5px; border-radius: 50%; background: #62cea1; }
.demo-lot-items { display: flex; align-items: center; gap: 6px; }
.demo-lot-items .demo-item { width: 34px; height: 34px; }
.demo-lot-more { color: var(--muted); font-size: 12px; white-space: nowrap; }
.demo-lot-sum { color: var(--muted); font-size: 13px; }
.demo-lot-sum b { color: var(--gold); font-size: 15px; }
.demo-lot-view { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.demo-lot, .demo-chat { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.demo-lot-title { margin-bottom: 10px; }
.demo-grid-cells { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin-bottom: 10px; }
/* Пустые клеточки сетки — <i>: их 20–29 на лот, короткая разметка держит страницу лёгкой. */
.demo-cell, .demo-grid-cells > i { position: relative; display: flex; align-items: center; justify-content: center; aspect-ratio: 1; border: 1px solid #343a45; border-radius: 7px; background: #1d2027; }
.demo-grid-cells > i { border-color: #23272f; background: #14171c; }
.demo-cell .demo-item { width: 100%; height: 100%; border: 0; background: none; }
.demo-cell .demo-item-tier { right: auto; left: 3px; bottom: auto; top: 3px; }
.demo-cell-qty { position: absolute; right: 3px; bottom: 2px; color: #e5e7ea; font-size: 10px; font-weight: 650; line-height: 1; text-shadow: 0 0 3px #000, 0 0 3px #000; }
.demo-lot-prices { margin-bottom: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.demo-lot-prices b { color: #e5e7ea; }
.demo-chat .demo-chart-title { margin-top: 0; }
.demo-chat ul { display: flex; flex-direction: column; gap: 8px; }
.demo-chat li { display: flex; flex-direction: column; align-self: flex-start; max-width: 88%; }
.demo-chat li.mine { align-self: flex-end; align-items: flex-end; }
.demo-chat li small { color: var(--faint); font-size: 11px; }
.demo-chat li span { padding: 7px 11px; border-radius: 10px; background: #1d2027; font-size: 13.5px; line-height: 1.4; }
.demo-chat li.mine span { background: rgba(207, 178, 124, .13); }

/* Продать выгодно */
.demo-advice { margin-top: 12px; padding: 14px 16px; border: 1px solid #5a4d30; border-left: 3px solid var(--gold); border-radius: 10px; background: #1a1812; }
.demo-advice p { color: #c3c7cf; font-size: 13.5px; }
.demo-advice p + p { margin-top: 8px; }
.demo-advice .demo-advice-text { color: #e5e7ea; font-size: 17px; font-weight: 620; line-height: 1.4; text-wrap: pretty; }
.demo-advice .demo-advice-fallback { color: var(--muted); }
.demo-table-wrap { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.demo-table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
.demo-table th, .demo-table td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--line); }
.demo-table th:first-child { text-align: left; }
.demo-table thead th { color: var(--faint); font-size: 11.5px; font-weight: 600; }
.demo-table tbody th { font-weight: 600; }
.demo-table tbody tr:last-child th, .demo-table tbody tr:last-child td { border-bottom: 0; }
.demo-table small { color: var(--muted); font-weight: 400; }
/* Пометка сервера к городу («заявок не видим — посчитали по обычной цене») — своей строкой под городом. */
.demo-table tbody tr:has(+ .demo-note-row) th, .demo-table tbody tr:has(+ .demo-note-row) td { border-bottom: 0; padding-bottom: 2px; }
.demo-table .demo-note-row td { padding-top: 0; text-align: left; color: var(--faint); font-size: 11.5px; line-height: 1.4; }

/* Новости и бонус дня */
.demo-news { display: grid; gap: 8px; }
.demo-news li { position: relative; display: flex; align-items: center; gap: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.demo-news li.rare { border-color: #6b5a33; box-shadow: 0 0 14px rgba(217, 181, 106, .1); }
.demo-news-badge { position: absolute; left: 40px; top: 6px; display: flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%;
  background: #23272f; color: var(--muted); box-shadow: 0 0 0 2px var(--panel); }
.demo-news .down .demo-news-badge { color: #62cea1; }
.demo-news .up .demo-news-badge { color: #e2b765; }
.demo-news .rare .demo-news-badge { color: var(--gold); }
.demo-news-text { font-size: 13.5px; line-height: 1.45; }
.demo-news-text small { display: block; margin-top: 2px; color: var(--faint); font-size: 12px; }
.demo-bonus-line { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; color: var(--gold); font-size: 14px; font-weight: 600; }
.demo-bonus-tag { color: var(--gold); }
.demo-row.static { margin-top: 12px; }

/* Подпись: это пример, а не сегодняшние цены */
.demo-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 12px; padding: 10px 14px;
  border: 1px dashed #6b5a33; border-radius: 10px; background: rgba(207, 178, 124, .06); color: #d8cba9; font-size: 13px; line-height: 1.45; }
.demo-enter { display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border: 1px solid #6b5a33; border-radius: 8px; color: var(--gold);
  font-weight: 600; text-decoration: none; white-space: nowrap; }
.demo-enter:hover { background: rgba(207, 178, 124, .1); }
.hint a { color: inherit; }

/* Без скриптов переключать нечем: остаётся первый пример, неработающие кнопки не показываются. */
@media (scripting: none) {
  .demo-run, .demo-tab[aria-pressed="false"], .demo-lot-card[aria-pressed="false"] { display: none; }
}

@media (max-width: 860px) {
  .demo-lot-view { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .demo-body { padding: 12px; }
  .demo-row summary, .demo-row-body { grid-template-columns: 14px 40px minmax(0, 1fr); gap: 8px 10px; padding: 12px 10px; align-items: start; }
  .demo-figures { grid-column: 1 / -1; flex-wrap: wrap; gap: 8px 16px; }
  /* Строка «Готово. Это сохранённый пример…» на телефоне занимает две строки — место под обе занято заранее. */
  .demo-status { min-height: 38px; }
  .demo-figure { align-items: flex-start; }
  .demo-details { padding: 12px 10px 14px; }
  .demo-actions .demo-tabs { margin-left: 0; }
  .demo-run { width: 100%; justify-content: center; }
  .demo-lot-cards { grid-template-columns: 1fr; }
  .demo-home-tabs .demo-tab { min-height: 40px; padding: 6px 12px; font-size: 13px; }
  .demo-axis { font-size: 18px; }
  .demo-table { font-size: 12px; }
  .demo-table th, .demo-table td { padding: 7px 6px; }
  .demo-advice .demo-advice-text { font-size: 15.5px; }
  .demo-caption { flex-direction: column; align-items: stretch; }
  .demo-enter { justify-content: center; }
  .is-waiting .demo-wait { top: 40px; width: max-content; }
}
@media (prefers-reduced-motion: reduce) {
  .demo-list, .demo-run, .demo-tab, .demo-toggle, .demo-lot-card { transition: none; }
}
