:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c2330;
  --text: #e6edf3;
  --muted: #9aa7b4;
  --line: #2a313c;
  --green: #2ec26a;
  --red: #ff4d4d;
  --gold: #f5c451;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #1a2230 0%, var(--bg) 60%);
  color: var(--text);
  min-height: 100vh;
}

.wrap {
  width: 80%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}
@media (max-width: 700px) { .wrap { width: 94%; } }

.hero { text-align: center; margin-bottom: 28px; }

h1 {
  font-size: clamp(34px, 7vw, 64px);
  margin: 0 0 12px;
  letter-spacing: -1px;
  background: linear-gradient(180deg, #ffe9a3, #e3ab15);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.sub { color: var(--muted); max-width: 620px; margin: 0 auto; line-height: 1.55; }
.sub b { color: var(--gold); }

.stage { text-align: center; margin: 34px 0; }

.big-red {
  appearance: none;
  border: none;
  cursor: pointer;
  font-size: clamp(18px, 3.5vw, 24px);
  font-weight: 800;
  color: #3d2e00;
  padding: 26px 44px;
  border-radius: 999px;
  background: radial-gradient(circle at 50% 28%, #ffe9a3, #e3ab15 72%);
  box-shadow: 0 12px 0 #9c7a0c, 0 22px 40px rgba(224,167,18,.45);
  transition: transform .08s ease, box-shadow .08s ease;
}
.big-red:hover { filter: brightness(1.05); }
.big-red:active { transform: translateY(8px); box-shadow: 0 4px 0 #9c7a0c, 0 10px 20px rgba(224,167,18,.4); }
.big-red:disabled { opacity: .6; cursor: progress; transform: none; }

.status { color: var(--muted); min-height: 22px; margin-top: 18px; font-size: 14px; }

.result.hidden { display: none; }
.result { margin-top: 14px; }

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 13px;
}
.card .label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
/* Лейблы карточек строки — одинаковой высоты, чтобы значения шли по одной линии. */
.card:not(.big) .label { min-height: 2.5em; }
.card .value { font-size: clamp(16px, 1.4vw, 20px); font-weight: 700; white-space: nowrap; margin-top: auto; }
.card.big { grid-column: 1 / -1; text-align: center; padding: 22px; }
.card.big .value { font-size: clamp(30px, 6vw, 44px); margin-top: 0; }
.pos { color: var(--green); }
.neg { color: var(--red); }
.muted { color: var(--muted); }
.card .subval { font-size: 14px; font-weight: 600; margin-top: 5px; opacity: .85; }

.verdict { text-align: center; font-size: 18px; margin: 6px 0 6px; color: var(--muted); }
.hint { text-align: center; font-size: 13px; color: var(--muted); margin: 0 0 20px; }
.note { text-align: center; font-size: 12.5px; color: var(--muted); margin: 14px auto 0; max-width: 720px; line-height: 1.5; }
.note b { color: var(--gold); }

.minichart { margin: 14px -4px 4px; }
.chart { width: 100%; height: auto; display: block; cursor: crosshair; }
.chart-cap { color: var(--muted); font-size: 12px; text-align: center; margin-top: 6px; }
.nochart { color: var(--muted); font-size: 13px; text-align: center; padding: 30px 0; }

tbody tr { cursor: pointer; }

/* Модалка с графиком по бумаге */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 7, 11, .72);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; backdrop-filter: blur(3px);
}
.modal.hidden { display: none; }
.modal-card {
  position: relative; width: min(720px, 100%);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 22px 22px 18px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.modal-close {
  position: absolute; top: 10px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 28px; line-height: 1; cursor: pointer;
}
.modal-close:hover { color: var(--text); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-tk { font-size: 24px; font-weight: 700; }
.modal-name { color: var(--muted); font-size: 14px; }
.modal-val { font-size: 26px; font-weight: 700; }
.modal-stats { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.modal-stats b { color: var(--text); }

.divlist { margin: 12px 0 4px; }
.divlist-h { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.divrow {
  display: inline-block; margin: 0 8px 8px 0; padding: 5px 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; font-size: 12px; color: var(--text); white-space: nowrap;
}
.btn-share-sm { display: block; width: 100%; margin-top: 14px; padding: 12px 18px; font-size: 14px; }

table { width: 100%; border-collapse: collapse; font-size: 19px; }
thead th {
  text-align: right; color: var(--muted); font-weight: 600;
  padding: 15px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 15.5px;
}
thead th:first-child, tbody td:first-child { text-align: left; }
th.sortable { cursor: pointer; user-select: none; transition: color .12s ease; }
th.sortable:hover { color: var(--text); }
th.active { color: var(--text); }
tbody td { padding: 18px 12px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
.tk { font-weight: 700; font-size: 19px; }
.tk small { display: block; color: var(--muted); font-weight: 400; font-size: 14px; margin-top: 3px; }

/* CTA — главный элемент по центру; шаринг — деликатной ссылкой под ним. */
.actions { display: flex; flex-direction: column; align-items: center; gap: 16px; margin-top: 34px; }
.actions .again { margin: 0; }

.share-link {
  appearance: none; cursor: pointer;
  background: none; border: none;
  color: var(--muted); font-size: 15px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 16px; border-radius: 10px;
  transition: color .14s ease, background .14s ease;
}
.share-link:hover { color: var(--text); background: var(--panel-2); }
.share-link.ok { color: var(--green); }

/* Кнопка шаринга графика акции — внутри модалки (вторичная). */
.btn-share {
  appearance: none; cursor: pointer;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 14px 22px; font-size: 15px; font-weight: 600;
  transition: border-color .12s ease, color .12s ease;
}
.btn-share:hover { border-color: var(--muted); }
.btn-share.ok { color: var(--green); border-color: var(--green); }

.banner {
  text-align: center; color: var(--muted); font-size: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 16px; margin-bottom: 18px;
}

.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 40px; line-height: 1.6; }
.foot a { color: var(--muted); }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  #tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 14.5px; }
  thead th { font-size: 12px; padding: 11px 4px; }
  tbody td { padding: 13px 4px; }
  .tk { font-size: 14.5px; }
  .tk small { font-size: 11.5px; }
  .wrap { padding: 24px 11px 50px; }
}
