:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --line: #e6eaf2;
  --line-soft: #eef1f7;
  --text: #1b2434;
  --text-2: #4d5a70;
  --muted: #8b96a8;
  --blue: #2b5cff;
  --blue-soft: #eaf0ff;
  --over: #e23b52;
  --over-soft: #fdecef;
  --under: #0c9b74;
  --under-soft: #e7f7f1;
  --amber: #e0942a;
  --amber-soft: #fff4e3;
  --shadow: 0 2px 6px rgba(24, 40, 80, .035), 0 10px 30px rgba(24, 40, 80, .045);
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; }
button { cursor: pointer; }
.app { display: grid; grid-template-columns: 238px 1fr; min-height: 100vh; }

/* ---------------- sidebar ---------------- */
.sidebar {
  background: #fff; border-right: 1px solid var(--line);
  padding: 22px 16px 18px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, #2b5cff, #6b8cff); font-size: 20px;
  box-shadow: 0 6px 16px rgba(43, 92, 255, .25);
}
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: .2px; }
.brand-sub { font-size: 10px; color: var(--muted); letter-spacing: 1.3px; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 11px 12px;
  border: 0; border-radius: 10px; background: transparent; color: var(--text-2);
  font-weight: 500; text-align: left; transition: .15s;
}
.nav-item .ni { font-size: 16px; width: 18px; text-align: center; color: var(--muted); }
.nav-item:hover { background: #f5f7fc; color: var(--text); }
.nav-item.active { background: var(--blue-soft); color: var(--blue); font-weight: 650; }
.nav-item.active .ni { color: var(--blue); }
.nav-badge { margin-left: auto; font-size: 11px; background: #eef1f7; color: var(--muted); padding: 2px 7px; border-radius: 20px; font-variant-numeric: tabular-nums; }
.nav-item.active .nav-badge { background: #d8e3ff; color: var(--blue); }
.side-block { margin-top: 30px; padding: 0 10px; }
.side-label { font-size: 10px; letter-spacing: 1.2px; color: var(--muted); font-weight: 700; margin-bottom: 12px; }
.source-row { display: flex; align-items: center; gap: 9px; font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.dot.green { background: #18b47c; box-shadow: 0 0 0 3px #e3f7ef; }
.dot.blue { background: #2b5cff; box-shadow: 0 0 0 3px #e7edff; }
.dot.amber { background: #e5a13a; box-shadow: 0 0 0 3px #fff2dc; }
.side-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line-soft); }
.disclaimer-title { font-size: 11px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.side-foot p { font-size: 10.5px; line-height: 1.7; color: var(--muted); margin: 0; }
.version { margin-top: 14px; font-size: 10px; color: var(--muted); letter-spacing: .8px; }

/* ---------------- main ---------------- */
.main { min-width: 0; }
.topbar {
  height: 82px; background: #fff; border-bottom: 1px solid var(--line);
  padding: 0 30px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 19px; font-weight: 700; letter-spacing: .2px; }
.page-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.topbar-right { display: flex; align-items: center; gap: 18px; }
.live-state { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-2); }
.btn {
  border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 9px 15px; border-radius: 10px; font-weight: 600; font-size: 13px;
  transition: .16s; white-space: nowrap;
}
.btn:hover { border-color: #c8d2e6; box-shadow: 0 3px 10px rgba(24,40,80,.06); }
.btn-primary {
  background: linear-gradient(135deg, #2b5cff, #4b76ff); border-color: transparent; color: #fff;
  padding: 11px 19px; box-shadow: 0 5px 16px rgba(43, 92, 255, .24); display: flex; align-items: center; gap: 9px;
}
.btn-primary:hover { box-shadow: 0 7px 22px rgba(43, 92, 255, .34); transform: translateY(-1px); }
.btn-primary:disabled { opacity: .7; transform: none; cursor: progress; }
.btn-ghost { padding: 8px 13px; font-size: 12px; color: var(--text-2); }
.btn-ghost.active { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); font-weight: 600; }
.btn-icon { font-size: 16px; display: inline-block; }
.spin .btn-icon { animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

.progress-strip { padding: 12px 30px; background: #fff; border-bottom: 1px solid var(--line); }
.ps-text { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.ps-text span:first-child { font-weight: 650; color: var(--blue); }
.ps-bar { height: 5px; background: #eef1f7; border-radius: 6px; overflow: hidden; }
.ps-bar div { height: 100%; width: 0%; background: linear-gradient(90deg, #2b5cff, #7d9bff); border-radius: 6px; transition: width .3s; }

.kpi-grid { padding: 22px 30px 4px; display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 15px 16px;
  box-shadow: var(--shadow); min-width: 0;
}
.kpi-label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 23px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.kpi-value.blue { color: var(--blue); }
.kpi-value.over { color: var(--over); }
.kpi-value.under { color: var(--under); }
.kpi-foot { font-size: 10.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.view { display: none; padding: 20px 30px 40px; }
.view.active { display: block; }
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.seg { display: inline-flex; background: #e9edf5; padding: 3px; border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 7px 15px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--text-2); }
.seg button.active { background: #fff; color: var(--blue); box-shadow: 0 2px 6px rgba(24,40,80,.08); }
.select, .input {
  border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 11px;
  color: var(--text); outline: none; font-size: 12px;
}
.select:focus, .input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.legend { display: flex; align-items: center; gap: 14px; font-size: 11px; color: var(--muted); }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }
.lg.over { background: var(--over); } .lg.under { background: var(--under); }
.legend-note { border-left: 1px solid var(--line); padding-left: 14px; }

/* ---------------- match cards ---------------- */
.match-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.match-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; transition: .18s; cursor: pointer;
}
.match-card:hover { border-color: #cbd7f5; box-shadow: 0 6px 22px rgba(30, 60, 120, .1); transform: translateY(-2px); }
.mc-top { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); }
.mc-league { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.league-tag { background: #f0f3fa; border-radius: 5px; padding: 3px 7px; font-size: 10.5px; color: var(--text-2); }
.mc-time { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mc-body { display: grid; grid-template-columns: 1fr 218px; }
.mc-left { padding: 15px 16px; min-width: 0; }
.teams { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 650; line-height: 1.5; }
.teams .vs { color: var(--muted); font-weight: 400; font-size: 11px; }
.team-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.zh-name { font-size: 11px; color: var(--blue); background: var(--blue-soft); border-radius: 6px; padding: 1px 6px; margin-left: 4px; white-space: nowrap; }
.score-inline { color: var(--text); font-variant-numeric: tabular-nums; }
.odds-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.odds-cell { background: #f7f9fd; border: 1px solid var(--line-soft); border-radius: 9px; padding: 8px 9px; min-width: 0; }
.oc-label { font-size: 10px; color: var(--muted); margin-bottom: 5px; white-space: nowrap; }
.oc-value { font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oc-sub { font-size: 10px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { display: inline-block; font-size: 10px; padding: 2px 6px; border-radius: 5px; margin-top: 9px; }
.chip.up { background: var(--over-soft); color: var(--over); }
.chip.down { background: var(--under-soft); color: var(--under); }
.chip.flat { background: #f0f3fa; color: var(--muted); }
.mc-right { border-left: 1px solid var(--line-soft); padding: 14px 16px; background: linear-gradient(180deg, #fbfcff, #fff); }
.pick-label { font-size: 10px; color: var(--muted); letter-spacing: .5px; }
.pick-main { display: flex; align-items: baseline; gap: 7px; margin-top: 4px; }
.pick-word { font-size: 25px; font-weight: 800; letter-spacing: 1px; }
.pick-word.over { color: var(--over); }
.pick-word.under { color: var(--under); }
.pick-line { font-size: 14px; color: var(--text-2); font-weight: 650; }
.pick-mu { font-size: 11.5px; color: var(--text-2); margin-top: 5px; }
.pick-mu b { color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.prob-bar { height: 7px; background: #e9edf5; border-radius: 6px; margin: 11px 0 6px; position: relative; overflow: hidden; }
.prob-bar i { display: block; height: 100%; border-radius: 6px; }
.prob-legend { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted); }
.conf { display: flex; align-items: center; gap: 5px; }
.conf-bar { width: 42px; height: 4px; background: #e9edf5; border-radius: 4px; overflow: hidden; }
.conf-bar i { display: block; height: 100%; background: var(--blue); }
.mc-empty { grid-column: 1 / -1; text-align: center; padding: 60px 20px; color: var(--muted); }
.mc-empty b { display: block; color: var(--text-2); margin-bottom: 8px; font-size: 14px; }
.no-odds { background: #f7f9fd; border: 1px dashed var(--line); border-radius: 9px; padding: 12px; font-size: 11.5px; color: var(--muted); text-align: center; margin-top: 14px; }

.refresh-result {
  background: #fff; border: 1px solid #cfe0ff; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.rr-head { font-size: 12.5px; font-weight: 700; color: var(--blue); margin-bottom: 10px; display: flex; justify-content: space-between; }
.rr-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; }
.rr-item { font-size: 11.5px; color: var(--text-2); display: flex; justify-content: space-between; gap: 8px; border-bottom: 1px dashed var(--line-soft); padding: 4px 0; }
.rr-item b { font-variant-numeric: tabular-nums; }
.flip { color: var(--over); font-weight: 700; }

/* ---------------- generic card / table ---------------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card-title { font-size: 14px; font-weight: 700; }
.card-desc { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; font-size: 10.5px; color: var(--muted); font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line-soft); color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafbfe; }
.table .strong { color: var(--text); font-weight: 650; }
.tag { display: inline-block; padding: 2px 7px; border-radius: 5px; font-size: 10.5px; }
.tag.over { background: var(--over-soft); color: var(--over); }
.tag.under { background: var(--under-soft); color: var(--under); }
.tag.gray { background: #f0f3fa; color: var(--muted); }
.model-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.chart-box { min-height: 190px; }
.data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.form-row label { font-size: 11.5px; color: var(--text-2); width: 88px; flex: none; }
.form-row .input { flex: 1; }
.form-col { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.form-col label { font-size: 11.5px; color: var(--text-2); }
.textarea { min-height: 88px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 11px; line-height: 1.6; }
.hint-box { background: #f7f9fd; border: 1px solid var(--line-soft); border-radius: 10px; padding: 12px 14px; font-size: 11.5px; line-height: 1.8; color: var(--text-2); margin: 18px 0 4px; }
.hint-box b { color: var(--text); }
.hint-box code { background: #eaeef7; padding: 1px 5px; border-radius: 4px; font-size: 11px; }
.stat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat-item { background: #f7f9fd; border-radius: 9px; padding: 11px 13px; }
.stat-item .k { font-size: 10.5px; color: var(--muted); }
.stat-item .v { font-size: 15px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; word-break: break-all; }
.log-list { max-height: 280px; overflow-y: auto; }
.log-item { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; }
.log-item:last-child { border-bottom: 0; }
.log-time { color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.log-kind { color: var(--blue); font-weight: 600; flex: none; min-width: 82px; }
.log-detail { color: var(--text-2); line-height: 1.5; }
.log-ok { width: 6px; height: 6px; border-radius: 50%; background: #18b47c; margin-top: 5px; flex: none; }
.log-ok.bad { background: var(--over); }

/* ---------------- drawer ---------------- */
.drawer-mask { position: fixed; inset: 0; background: rgba(18, 28, 48, .32); z-index: 40; opacity: 0; pointer-events: none; transition: .22s; }
.drawer-mask.show { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0; width: min(640px, 94vw); background: #fff; z-index: 41;
  transform: translateX(102%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  box-shadow: -12px 0 40px rgba(20,35,70,.14); display: flex; flex-direction: column;
}
.drawer.show { transform: translateX(0); }
.drawer-head { padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.icon-btn { border: 0; background: #f2f5fa; width: 30px; height: 30px; border-radius: 8px; color: var(--text-2); }
.drawer-body { padding: 20px 24px 40px; overflow-y: auto; }
.sec-title { font-size: 12px; font-weight: 700; margin: 22px 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title:first-child { margin-top: 0; }
.sec-title::before { content: ''; width: 3px; height: 13px; background: var(--blue); border-radius: 3px; }
.hero-pick { display: flex; align-items: center; gap: 22px; background: linear-gradient(135deg, #f7f9ff, #fff); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }
.hero-word { font-size: 34px; font-weight: 800; letter-spacing: 2px; }
.hero-word.over { color: var(--over); } .hero-word.under { color: var(--under); }
.hero-meta { flex: 1; }
.hero-meta .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hero-meta .small { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.factor-row { display: grid; grid-template-columns: 110px 1fr 74px; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.factor-row:last-child { border-bottom: 0; }
.factor-name { font-size: 11.5px; font-weight: 600; }
.factor-desc { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.factor-value { font-size: 12px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.form-game { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 11.5px; color: var(--text-2); }
.form-game:last-child { border-bottom: 0; }
.form-badge { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; background: #f0f3fa; flex: none; }
.form-badge.w { background: var(--under-soft); color: var(--under); }
.form-badge.l { background: var(--over-soft); color: var(--over); }
.odds-timeline { display: flex; flex-direction: column; gap: 8px; }
.ot-item { display: flex; justify-content: space-between; font-size: 11.5px; background: #f7f9fd; padding: 9px 11px; border-radius: 8px; }
.band-list { display: flex; gap: 8px; }
.band-item { flex: 1; background: #f7f9fd; border-radius: 9px; padding: 11px 8px; text-align: center; }
.band-item .b1 { font-size: 10.5px; color: var(--muted); }
.band-item .b2 { font-size: 16px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; }

/* ---------------- charts ---------------- */
svg.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-note { font-size: 10.5px; color: var(--muted); margin-top: 8px; text-align: center; }
.empty-note { color: var(--muted); font-size: 12px; text-align: center; padding: 40px 10px; line-height: 1.8; }
.toast {
  position: fixed; right: 26px; bottom: 26px; background: #1d283c; color: #fff; padding: 12px 18px;
  border-radius: 10px; font-size: 12.5px; box-shadow: 0 8px 28px rgba(20,30,50,.24);
  opacity: 0; transform: translateY(10px); pointer-events: none; transition: .22s; z-index: 60; max-width: 380px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.bad { background: #b72b41; }

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .match-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .model-grid, .data-grid, .split-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); padding: 16px; }
  .view { padding: 16px; }
  .topbar { padding: 0 16px; }
  .mc-body { grid-template-columns: 1fr; }
  .mc-right { border-left: 0; border-top: 1px solid var(--line-soft); }
}
