:root {
  color-scheme: dark;
  --bg: #050706;
  --panel: #0b0e0c;
  --panel-raised: #101410;
  --ink: #f4f1e7;
  --muted: #9ba297;
  --faint: #687066;
  --line: rgb(220 174 77 / 24%);
  --line-soft: rgb(255 255 255 / 8%);
  --gold: #dcad4d;
  --gold-bright: #f2c765;
  --orange: #ed7c28;
  --orange-soft: rgb(237 124 40 / 10%);
  --blue: #4d8fff;
  --blue-soft: rgb(77 143 255 / 10%);
  --positive: #55d58a;
  --negative: #ff7068;
  --shadow: 0 20px 55px rgb(0 0 0 / 35%);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% -8%, rgb(220 173 77 / 11%), transparent 29rem),
    radial-gradient(circle at 94% 3%, rgb(77 143 255 / 6%), transparent 24rem),
    linear-gradient(180deg, #070907 0, var(--bg) 34rem);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.42;
}

button, summary { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  min-height: 46px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: baseline;
  gap: 8px;
  color: var(--gold-bright);
  text-decoration: none;
  white-space: nowrap;
}

.brand__title { color: var(--gold-bright); font-size: 1.5rem; font-weight: 850; letter-spacing: .08em; }
.brand__byline { color: var(--gold-bright); font-size: .75rem; font-weight: 650; letter-spacing: .04em; }
.footer-panel {
  margin-top: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgb(12 15 12 / 76%);
  color: var(--muted);
  font-size: .75rem;
}
.footer-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  color: var(--gold-bright);
  font-size: .75rem;
  font-weight: 650;
}
.footer-panel > summary::-webkit-details-marker { display: none; }
.footer-panel > summary:hover { background: rgb(255 255 255 / 3%); }
.footer-panel > summary:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -3px; }
.footer-panel__chevron { width: 8px; height: 8px; flex: 0 0 auto; border-right: 2px solid var(--gold); border-bottom: 2px solid var(--gold); transform: rotate(45deg) translate(-2px, -2px); transition: transform .18s ease; }
.footer-panel[open] > summary .footer-panel__chevron { transform: rotate(225deg) translate(-1px, -1px); }
.footer-panel__body { padding: 2px 12px 11px; border-top: 1px solid var(--line-soft); }
.metrics-table { width: 100%; table-layout: fixed; border-collapse: collapse; font-size: .75rem; font-variant-numeric: tabular-nums; }
.metrics-table col:first-child { width: 38%; }
.metrics-table col { width: 31%; }
.metrics-table th,
.metrics-table td { padding: 6px 2px; text-align: right; vertical-align: middle; font-weight: 500; }
.metrics-table th:first-child { text-align: left; }
.metrics-table thead th { padding-top: 8px; padding-bottom: 4px; font-size: .6875rem; line-height: 1.25; overflow-wrap: anywhere; }
.model-heading--rough { color: #f2a061; }
.model-heading--adaptive60 { color: #8ab6ff; }
.metric-yield th { color: var(--gold-bright); }
.metric-yield td { font-size: 1rem; font-weight: 750; white-space: nowrap; }
.metric-yield td.positive { color: var(--positive); }
.metric-yield td.negative { color: var(--negative); }
.metric-yield td.neutral { color: var(--muted); }
.metrics-section-title { padding-top: 10px !important; padding-bottom: 3px !important; border-top: 1px solid var(--line-soft); color: var(--muted); }
.metric-odds td { white-space: nowrap; }
.metric-odds--won { color: var(--positive); }
.metric-odds--lost { color: var(--negative); }
.metric-odds--overall { color: var(--gold-bright); }
.footer-meta { margin-top: 3px; padding-top: 6px; border-top: 1px solid var(--line-soft); color: var(--muted); font-variant-numeric: tabular-nums; }
.footer-meta > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px; padding: 3px 0; }
.footer-meta time { color: var(--ink); white-space: nowrap; }
.scoreboard { display: grid; gap: 12px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.summary-card,
.chart-card,
.histories {
  background: linear-gradient(145deg, rgb(16 20 16 / 97%), rgb(9 12 10 / 97%));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.summary-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px 18px;
  border-radius: 16px;
}

.summary-card::after {
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  content: "";
  background: var(--accent);
  opacity: .9;
}

.summary-card--orange { --accent: var(--orange); background: linear-gradient(145deg, var(--orange-soft), rgb(9 12 10 / 98%) 60%); }
.summary-card--blue { --accent: var(--blue); background: linear-gradient(145deg, var(--blue-soft), rgb(9 12 10 / 98%) 60%); }
.summary-card__top { display: flex; align-items: center; gap: 9px; }
.summary-card h2 { min-width: 0; margin: 0; font-size: .96rem; letter-spacing: -.01em; }
.swatch { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; box-shadow: 0 0 16px currentColor; }
.summary-card--orange .swatch, .history--orange .swatch { color: var(--orange); background: var(--orange); }
.summary-card--blue .swatch, .history--blue .swatch { color: var(--blue); background: var(--blue); }
.result { margin: 9px 0 4px; font-size: clamp(1.85rem, 5vw, 2.8rem); font-weight: 850; line-height: 1; letter-spacing: -.045em; }
.pending-summary { min-height: 1.2em; margin: 0 0 4px; color: var(--gold-bright); font-size: clamp(.925rem, 2.5vw, 1.4rem); font-weight: 750; line-height: 1.2; }
.result.positive, .net.positive, .history-day-total.positive { color: var(--positive); }
.result.negative, .net.negative, .history-day-total.negative { color: var(--negative); }
.result.neutral, .net.neutral, .history-day-total.neutral { color: var(--muted); }
.count { margin: 0; color: var(--muted); font-size: .78rem; }
.count-line { display: block; line-height: 1.4; }
.count-line strong { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-card { position: relative; padding: 14px; border-radius: 18px; }
.chart-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: center; gap: 12px; margin-bottom: 8px; }
.chart-period-toggle, .history-button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--gold-bright);
  font: inherit;
  font-size: .76rem;
  font-weight: 750;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgb(220 174 77 / 7%);
  cursor: pointer;
}
.chart-period-toggle:hover, .history-button:hover { background: rgb(220 174 77 / 13%); }
.chart-period-toggle { min-width: 0; width: 100%; white-space: nowrap; }
.chart-period-toggle[aria-pressed="true"] { border-color: var(--gold-bright); background: rgb(220 174 77 / 23%); }
.chart-period-toggle:focus-visible, .history-button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.chart-wrap {
  min-height: 290px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 13px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 2%), transparent),
    #080b09;
}
.chart-wrap svg { display: block; width: 100%; height: auto; touch-action: manipulation; }
.loading { margin: 126px 0; color: var(--muted); text-align: center; }
.chart-grid { stroke: rgb(255 255 255 / 10%); stroke-width: 1; }
.chart-zero { stroke: rgb(255 255 255 / 18%); stroke-width: 1; }
.sequence-guide { stroke: rgb(220 174 77 / 10%); stroke-width: 1; stroke-dasharray: 3 6; }
.chart-axis-label, .chart-caption { fill: var(--muted); font-size: 11px; font-weight: 600; }
.chart-extreme { font-size: 11px; font-weight: 800; paint-order: stroke; stroke: #080b09; stroke-width: 4px; stroke-linejoin: round; }
.chart-extreme--max { fill: var(--gold-bright); }
.chart-path { fill: none; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-path--combined { stroke-width: 2.5; }
.chart-day-marker { stroke: #080b09; stroke-width: 1.2; pointer-events: none; }
.chart-day-hit { cursor: pointer; }
.chart-day-hit:focus-visible { outline: none; stroke: #45c987; stroke-width: 1; }
.chart-day-guide { stroke: #45c987; stroke-width: 1; stroke-dasharray: 3 4; pointer-events: none; }
.chart-dot { cursor: pointer; stroke: #080b09; stroke-width: 2.5; transition: r .15s ease, filter .15s ease; }
.chart-dot:hover, .chart-dot:focus { r: 7; filter: drop-shadow(0 0 7px currentColor); outline: none; }
.chart-dot:focus-visible { stroke: var(--gold-bright); stroke-width: 3; }
.chart-empty { margin: 8px 0 0; color: var(--muted); font-size: .76rem; text-align: center; }
.chart-empty[hidden] { display: none; }

.chart-tooltip {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) repeat(3, auto);
  align-items: center;
  gap: 8px 18px;
  margin-top: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: #111611;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgb(0 0 0 / 30%);
}
.chart-tooltip[hidden] { display: none; }
.tooltip-main { min-width: 0; }
.tooltip-filter { color: var(--gold-bright); font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.tooltip-match { margin-top: 2px; font-size: .92rem; font-weight: 750; }
.tooltip-tournament { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.tooltip-stat { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.tooltip-stat strong { display: block; margin-top: 2px; color: var(--ink); font-size: .86rem; }
.tooltip-stat .positive { color: var(--positive); }
.tooltip-stat .negative { color: var(--negative); }

.histories { margin-top: 12px; padding: 12px; border-radius: 18px; }
.history { overflow: hidden; border: 1px solid var(--line-soft); border-radius: 12px; background: rgb(5 7 6 / 48%); }
.history + .history { margin-top: 8px; }
.history summary { display: grid; grid-template-columns: minmax(0, 1fr) auto 16px; align-items: center; gap: 14px; min-height: 54px; padding: 11px 14px; cursor: pointer; list-style: none; font-weight: 750; }
.history summary::-webkit-details-marker { display: none; }
.history summary:hover { background: rgb(255 255 255 / 3%); }
.history summary:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -3px; }
.summary-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
.summary-meta { color: var(--muted); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chevron { width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translate(-2px, -2px); transition: transform .18s ease; }
.history[open] .chevron { transform: rotate(225deg) translate(-1px, -1px); }

.history-body { padding: 8px 12px 12px; border-top: 1px solid var(--line-soft); }
.history-group + .history-group, .history-group + .history-button, .history-empty + .history-group, .history-empty + .history-button { margin-top: 12px; }
.history-group h3 { margin: 0; padding: 3px 3px 7px; color: var(--gold-bright); font-size: .78rem; letter-spacing: .02em; }
.history-group--special h3, .net.warning { color: #efb45d; }
.history-group--completed h3 { display: grid; grid-template-columns: minmax(max-content, 50%) minmax(0, 1fr); align-items: baseline; gap: 10px; color: var(--muted); }
.history-day-total { justify-self: start; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 1.08em; font-weight: 750; }
.history-empty { margin: 2px 3px; color: var(--muted); font-size: .78rem; }
.history-button { display: block; width: min(100%, 320px); margin: 12px auto 0; }
.match-list { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line-soft); }
.match-item { display: grid; grid-template-columns: 86px minmax(180px, 1fr) minmax(108px, auto); align-items: center; gap: 12px; padding: 7px 3px; border-bottom: 1px solid var(--line-soft); }
.match-item:last-child { border-bottom: 0; }
.date-time, .match-main, .match-outcome { display: grid; grid-template-rows: minmax(16px, auto) minmax(14px, auto); align-items: center; min-width: 0; row-gap: 2px; }
.date-time { color: var(--muted); font-size: .7rem; line-height: 1.05; }
.date-time strong { color: var(--ink); font-size: .84rem; line-height: 1.05; }
.match-name, .tournament { overflow: hidden; margin: 0; text-overflow: ellipsis; white-space: nowrap; }
.match-name { font-size: .86rem; font-weight: 750; line-height: 1.1; }
.tournament { color: var(--muted); font-size: .69rem; line-height: 1.05; }
.match-outcome { justify-items: end; }
.match-quote-line { display: flex; align-items: baseline; justify-content: flex-end; gap: 7px; min-width: 0; white-space: nowrap; }
.odds strong { color: var(--gold-bright); font-size: .84rem; line-height: 1.05; }
.score { min-height: 1em; color: var(--ink); font-size: .76rem; line-height: 1.05; text-align: right; }
.score strong { color: inherit; font-size: inherit; }
.net { text-align: right; font-size: .82rem; font-weight: 850; line-height: 1.05; white-space: nowrap; }
.match-status { grid-column: 2 / -1; min-width: 0; margin: 0; font-size: .72rem; line-height: 1.3; overflow-wrap: anywhere; }
.match-status--pending { color: var(--gold-bright); }
.match-status--refund { color: #c5cbd3; }
.match-item--refund { background: rgba(197,203,211,.045); }
.match-item--refund .match-name,
.match-item--refund .date-time strong,
.match-item--refund .odds strong,
.match-item--refund .score { color: #c5cbd3; }

@media (max-width: 820px) {
  .shell { width: min(100% - 20px, 680px); padding-top: 12px; }
  .topbar { min-height: 38px; margin-bottom: 8px; }
  .chart-wrap { min-height: 230px; }
  .match-item { grid-template-columns: 70px minmax(0, 1fr) minmax(86px, auto); gap: 8px; }
}

@media (max-width: 520px) {
  .shell { width: calc(100% - 12px); padding-top: 8px; padding-bottom: 18px; }
  .brand { gap: 6px; }
  .brand__title { font-size: 1.5rem; }
  .brand__byline { font-size: .75rem; }
  .footer-panel { border-radius: 10px; }
  .footer-panel > summary { min-height: 40px; padding: 8px 9px; font-size: .75rem; }
  .footer-panel__body { padding-right: 8px; padding-left: 8px; }
  .metrics-table { font-size: .75rem; }
  .metric-yield td { font-size: .9375rem; }
  .footer-meta > div { gap: 5px; }
  .summary-grid { gap: 7px; }
  .summary-card { padding: 11px; border-radius: 12px; }
  .summary-card__top { gap: 6px; }
  .summary-card h2 { font-size: .78rem; white-space: nowrap; }
  .swatch { width: 7px; height: 7px; }
  .result { margin-top: 7px; font-size: 1.55rem; }
  .pending-summary { font-size: .775rem; }
  .count { font-size: .64rem; line-height: 1.35; }
  .chart-card { padding: 8px; border-radius: 13px; }
  .chart-head { align-items: flex-start; gap: 7px; margin-bottom: 6px; }
  .chart-period-toggle { min-height: 32px; padding: 6px 8px; font-size: .68rem; }
  .chart-wrap { min-height: 205px; border-radius: 10px; }
  .chart-tooltip { grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 7px; padding: 10px; }
  .tooltip-main { grid-column: 1 / 3; }
  .tooltip-stat { font-size: .67rem; }
  .tooltip-stat strong { font-size: .76rem; }
  .histories { margin-top: 8px; padding: 7px; border-radius: 13px; }
  .history summary { grid-template-columns: minmax(0, 1fr) 12px; gap: 4px 7px; min-height: 58px; padding: 8px 9px; }
  .summary-title { grid-column: 1; grid-row: 1; font-size: .8rem; }
  .summary-meta { grid-column: 1 / 3; grid-row: 2; padding-left: 16px; font-size: .7rem; white-space: normal; }
  .chevron { grid-column: 2; grid-row: 1; }
  .history-body { padding: 7px 8px 9px; }
  .history-group h3 { font-size: .7rem; }
  .history-button { min-height: 34px; font-size: .7rem; }
  .match-list { padding: 0; }
  .match-item { grid-template-columns: 58px minmax(0, 1fr) minmax(76px, auto); gap: 6px; padding: 6px 0; }
  .date-time, .match-main, .match-outcome { grid-template-rows: 14px 12px; row-gap: 1px; }
  .date-time { font-size: .59rem; }
  .date-time strong { font-size: .72rem; }
  .match-name { font-size: .72rem; }
  .tournament { font-size: .58rem; }
  .match-quote-line { gap: 5px; }
  .odds strong, .net { font-size: .7rem; }
  .score { font-size: .64rem; }
}

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

/* Обособленный Test не меняет размеры основного представления. */
.test-panel { font-size: 1rem; }
.test-note { margin: 8px 12px; color: var(--muted); font-size: .6875rem; line-height: 1.4; }
#test-view { padding: 4px 0 0; color: var(--ink); }

/* Обозначение режима просмотра без изменения графика и карточек. */
.access-panel{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;margin:0 0 18px;border:1px solid #284234;border-radius:14px;background:#0c1711;color:#bacabd;font-size:14px;line-height:1.5}
.access-panel p{margin:0}.access-button{flex-shrink:0;border:1px solid #43614d;border-radius:9px;padding:8px 15px;background:#14251a;color:#ecf6ef;text-decoration:none;font:inherit;cursor:pointer}.access-button[hidden]{display:none}
@media(max-width:560px){.access-panel{align-items:flex-start;font-size:13px;padding:12px;gap:10px}}

/* Вход и выход внизу раскрывающегося меню «Данные». */
.footer-panel__body > .access-panel { margin: 12px 0 0; }
