:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: #0d1923;
  --panel-2: #101f2b;
  --line: #20313e;
  --text: #f3f7fa;
  --muted: #8fa3b3;
  --mint: #45e6b0;
  --blue: #45a9ff;
  --red: #ff6b78;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #102838 0, var(--bg) 42%);
  color: var(--text);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main { width: min(1380px, calc(100% - 28px)); margin: 0 auto; padding: 26px 0 48px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
h1 { margin: 0; font-size: clamp(25px, 5vw, 36px); letter-spacing: -.04em; }
.brand-heading { display: flex; align-items: baseline; gap: 8px; }
.product-version {
  padding: 2px 7px;
  border: 1px solid #385266;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.status { display: inline-flex; align-items: center; gap: 8px; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dot { width: 9px; height: 9px; border-radius: 999px; background: var(--muted); box-shadow: 0 0 0 4px rgba(143, 163, 179, .1); }
.status.ok .dot { background: var(--mint); box-shadow: 0 0 0 4px rgba(69, 230, 176, .12); }
.status.partial .dot { background: #f2c266; box-shadow: 0 0 0 4px rgba(242, 194, 102, .12); }
.status.error .dot { background: var(--red); box-shadow: 0 0 0 4px rgba(255, 107, 120, .12); }

.telegram, button {
  border: 1px solid #267fbd;
  border-radius: 11px;
  background: #0d5180;
  color: #fff;
  padding: 10px 14px;
  font: inherit;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
}
.telegram:hover, button:hover { background: #12679f; }
.calculator-button { background: transparent; border-color: #385266; color: var(--text); }

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 160px)) 1fr;
  gap: 9px;
  margin-bottom: 10px;
}
.summary > div, .summary time, .filters {
  border: 1px solid var(--line);
  background: rgba(13, 25, 35, .9);
}
.summary > div, .summary time { min-height: 70px; border-radius: 13px; padding: 12px 14px; }
.summary span { display: block; color: var(--muted); font-size: 11px; }
.summary strong { display: block; margin-top: 1px; font-size: 24px; }
.summary time { display: flex; align-items: center; justify-content: flex-end; color: var(--muted); font-size: 12px; }

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr)) repeat(5, minmax(95px, .7fr)) auto auto;
  gap: 9px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border-radius: 14px;
  position: relative;
  z-index: 2;
}
.filters > label, .filter-field { display: grid; gap: 5px; color: var(--muted); font-size: 11px; min-width: 0; }
.filters select, .filters input[type="number"], .multi-filter summary {
  width: 100%;
  min-height: 38px;
  border: 1px solid #2a4151;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  padding: 7px 9px;
  font: inherit;
}
.multi-filter details { position: relative; }
.multi-filter summary {
  display: list-item;
  list-style-position: inside;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.multi-filter summary::marker { color: var(--muted); }
.multi-filter details[open] summary { border-color: var(--blue); }
.multi-filter summary:focus-visible, .filters select:focus-visible, .filters input:focus-visible, .filters button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.selection-label { margin-left: 4px; }
.multi-options {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: auto;
  z-index: 20;
  width: max(100%, 12rem);
  max-width: min(18.5rem, calc(100vw - 24px));
  max-height: 250px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid #36566d;
  border-radius: 10px;
  background: #10212d;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .42);
}
#sportFilter .multi-options {
  width: max(100%, 14rem);
}
#leagueFilter .multi-options {
  width: max(100%, 17.5rem);
}
#marketFilter .multi-options {
  width: max(100%, 15rem);
}
.multi-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-height: 34px;
  min-width: 0;
  padding: 6px 7px;
  border-radius: 7px;
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
}
.multi-option span {
  min-width: 0;
  overflow-wrap: break-word;
}
.multi-option:hover { background: rgba(69, 169, 255, .11); }
.multi-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--mint); }
.league-group + .league-group { margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(78, 111, 132, .45); }
.league-group-title {
  position: sticky;
  top: -6px;
  z-index: 1;
  padding: 6px 7px 5px;
  background: #10212d;
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.league-option-copy { display: flex; flex: 1; align-items: flex-start; justify-content: space-between; gap: 8px; }
.league-option-label { flex: 1; }
.league-sport-badge {
  flex: 0 0 auto;
  max-width: 8.5rem;
  padding: 2px 5px;
  border: 1px solid #38566b;
  border-radius: 999px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-align: right;
}
.multi-option input:disabled { cursor: not-allowed; opacity: .8; }
.no-options { display: block; padding: 8px; color: var(--muted); font-size: 12px; }
.filters .check { display: flex; min-height: 38px; align-items: center; gap: 7px; color: var(--text); white-space: nowrap; }
.filters .check input { width: 17px; min-height: 17px; accent-color: var(--mint); }
.filters button { min-height: 38px; background: transparent; border-color: #385266; color: var(--text); }

.table-shell { overflow-x: auto; border: 1px solid var(--line); border-radius: 15px; background: rgba(13, 25, 35, .94); }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
th { padding: 10px 12px; text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
td { padding: 12px; border-bottom: 1px solid rgba(32, 49, 62, .72); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.start { min-width: 104px; white-space: nowrap; color: var(--muted); }
.event { min-width: 235px; font-weight: 750; }
.context { min-width: 170px; text-transform: capitalize; }
.meta { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 400; text-transform: none; }
.odds { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lay-quote { display: inline-flex; align-items: center; gap: 6px; }
.lay-liquidity {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border: 1px solid rgba(69, 230, 176, .28);
  border-radius: 999px;
  background: rgba(69, 230, 176, .08);
  color: var(--mint);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.2;
}
.lay-liquidity.unavailable { border-color: var(--line); background: transparent; color: var(--muted); }
.roi { color: var(--muted); font-weight: 800; font-variant-numeric: tabular-nums; }
.roi.positive { color: var(--mint); }
.calc-action { width: 1%; text-align: right; white-space: nowrap; }
.calc-row-button { min-height: 34px; padding: 7px 10px; border-color: #385266; background: transparent; color: var(--text); font-size: 12px; }
.empty { display: grid; min-height: 220px; place-items: center; border: 1px solid var(--line); border-radius: 15px; color: var(--muted); background: rgba(13, 25, 35, .72); }
.empty[hidden] { display: none; }

.calculator-dialog {
  width: min(680px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  margin: auto;
  padding: 20px;
  overflow: auto;
  border: 1px solid #36566d;
  border-radius: 16px;
  background: #0d1923;
  color: var(--text);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
}
.calculator-dialog::backdrop { background: rgba(2, 7, 11, .76); backdrop-filter: blur(3px); }
.calculator-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.calculator-head h2 { margin: 0; font-size: 21px; letter-spacing: -.02em; }
.calculator-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.calculator-close { min-width: 38px; min-height: 38px; padding: 4px 10px; border-color: #385266; background: transparent; color: var(--text); font-size: 24px; line-height: 1; }
.calculator-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.calculator-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 11px; }
.calculator-fields input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #2a4151;
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  padding: 8px 10px;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.calculator-fields input:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.calculator-error { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(255, 107, 120, .45); border-radius: 9px; color: #ff9ca6; background: rgba(255, 107, 120, .09); }
.calculator-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.calculator-results[hidden] { display: none; }
.calculator-results > div { min-height: 70px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px; background: var(--panel-2); }
.calculator-results span { display: block; color: var(--muted); font-size: 11px; }
.calculator-results strong { display: block; margin-top: 3px; font-size: 19px; font-variant-numeric: tabular-nums; }
.calculator-results strong.positive { color: var(--mint); }
.calculator-results strong.negative { color: var(--red); }
.calculator-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; }

@media (max-width: 1400px) {
  .filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); }
  #leagueFilter .multi-options { left: auto; right: 0; }
}

@media (max-width: 700px) {
  main { width: min(100% - 16px, 1380px); padding-top: 16px; }
  header { align-items: flex-start; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .summary { grid-template-columns: repeat(3, 1fr); }
  .summary time { grid-column: 1 / -1; min-height: 42px; justify-content: flex-start; }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters > .check, .filters > button { grid-column: span 1; }
  .telegram { padding: 9px 11px; font-size: 12px; }
  .calculator-button { padding: 8px 10px; font-size: 12px; }
  .calculator-dialog { padding: 16px; }
  .calculator-fields, .calculator-results { grid-template-columns: 1fr; }
  .multi-options { max-height: min(55vh, 320px); }
  .league-option-copy { display: grid; gap: 3px; }
  .league-sport-badge { max-width: 100%; justify-self: start; text-align: left; }
  #exchangeFilter .multi-options,
  #leagueFilter .multi-options { left: auto; right: 0; }
}
