:root {
  color-scheme: light;
  --bg: #eef3f7;
  --ink: #101923;
  --muted: #627286;
  --surface: #fbfdff;
  --line: #cad7e2;
  --line-strong: #a9bbc9;
  --blue: #0b63b6;
  --green: #087a55;
  --green-bg: #e6f6ef;
  --red: #b42318;
  --red-bg: #fdeceb;
  --amber: #9a6400;
  --amber-bg: #fff4d8;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(14px, 2.4vw, 30px);
  background: #13202b;
  color: #f8fbff;
  border-bottom: 1px solid #29445d;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.12;
  font-weight: 780;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.topbar p {
  margin-top: 6px;
  color: #b9c7d5;
  font-size: 14px;
}

.status-stack {
  display: grid;
  justify-items: end;
  gap: 6px;
  color: #b9c7d5;
  white-space: nowrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 760;
  font-size: 13px;
}

.pill.neutral {
  color: #1d4f7a;
  background: #e6f2fb;
}

.pill.ok {
  color: var(--green);
  background: var(--green-bg);
}

.pill.bad {
  color: var(--red);
  background: var(--red-bg);
}

main {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 16px clamp(10px, 2vw, 26px) 36px;
  display: grid;
  gap: 14px;
}

.controls,
.summary-grid,
.rules,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(16 25 35 / 6%);
}

.controls {
  display: grid;
  grid-template-columns: repeat(9, minmax(110px, 1fr)) minmax(84px, auto);
  gap: 10px;
  padding: 12px;
  align-items: end;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 720;
}

input {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(11 99 182 / 15%);
}

button {
  min-height: 38px;
  border: 1px solid var(--blue);
  border-radius: 6px;
  background: var(--blue);
  color: #fff;
  font-weight: 780;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.summary-grid > div {
  min-height: 96px;
  padding: 18px;
  border-right: 1px solid var(--line);
  display: grid;
  align-content: center;
  gap: 7px;
}

.summary-grid > div:last-child {
  border-right: 0;
}

.summary-grid span,
.panel-head p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-grid strong {
  font-size: clamp(26px, 4vw, 46px);
  line-height: 1;
}

.rules {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.rules > div {
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.rules > div:last-child {
  border-right: 0;
}

.rules p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.legend {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-radius: 50%;
}

.dot.good {
  background: var(--green);
}

.dot.bad {
  background: var(--red);
}

.rows {
  display: grid;
}

.arb-row {
  display: grid;
  grid-template-columns: minmax(190px, 0.9fr) minmax(220px, 1.1fr) minmax(240px, 1.4fr) minmax(180px, 0.8fr) minmax(250px, 1.4fr);
  gap: 0;
  border-bottom: 1px solid var(--line);
}

.arb-row:last-child {
  border-bottom: 0;
}

.cell {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

.cell:last-child {
  border-right: 0;
}

.match-title {
  font-size: 18px;
  font-weight: 820;
}

.sub {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.money {
  font-size: 23px;
  font-weight: 840;
}

.positive {
  color: var(--green);
}

.negative {
  color: var(--red);
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.tag.good {
  color: var(--green);
  border-color: #99d7bf;
  background: var(--green-bg);
}

.tag.bad {
  color: var(--red);
  border-color: #f2aaa4;
  background: var(--red-bg);
}

.legs {
  display: grid;
  gap: 7px;
}

.strategy-cell {
  display: grid;
  gap: 10px;
}

.strategy {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.strategy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.strategy-head strong {
  color: var(--green);
  font-size: 16px;
}

.strategy-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  text-align: right;
}

.leg {
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fbfd;
}

.leg strong {
  display: block;
  font-size: 14px;
}

.leg span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.states {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.states.mini .state {
  font-size: 11px;
  padding: 4px 6px;
}

.fresh {
  color: var(--green);
  font-weight: 760;
}

.stale {
  color: var(--red);
  font-weight: 800;
}

.state {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 720;
}

.state-more {
  color: var(--ink);
  border-color: var(--line-strong);
  background: #eef4f8;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 760;
}

.notes {
  margin: 0;
  padding: 14px 34px 18px;
  color: var(--muted);
  line-height: 1.6;
}

@media (max-width: 1180px) {
  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .arb-row {
    grid-template-columns: 1fr;
  }

  .cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .cell:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 760px) {
  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .status-stack {
    justify-items: start;
  }

  .controls,
  .summary-grid,
  .rules {
    grid-template-columns: 1fr;
  }

  .summary-grid > div,
  .rules > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-grid > div:last-child,
  .rules > div:last-child {
    border-bottom: 0;
  }

  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .strategy-head {
    flex-direction: column;
  }

  .strategy-head span {
    text-align: left;
  }
}
