:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1a1d23;
  --muted: #6b7280;
  --line: #e2e6ec;
  --blue: #2f6bff;
  --home: #2f6bff;
  --draw: #e8a33d;
  --away: #e4572e;
  --green: #16a34a;
  --purple: #9333ea;
  --dark: #10162a;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  min-height: 100vh;
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 26px; background: rgba(255,255,255,.94);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.logo {
  width: 44px; height: 44px; border-radius: 12px; background: var(--dark);
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 20px;
}
.brand-title { font-size: 19px; font-weight: 700; }
.brand-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.tabs { display: flex; gap: 4px; background: #eef2f8; padding: 4px; border-radius: 12px; }
.tab {
  font: inherit; border: 0; background: transparent; color: var(--muted);
  padding: 8px 16px; border-radius: 9px; cursor: pointer; font-weight: 600;
}
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16,22,42,.12); }

.top-actions { display: flex; align-items: center; gap: 10px; }

select, input {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 12px; outline: none; min-width: 0;
  transition: border-color .15s, box-shadow .15s;
}
select:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
select { cursor: pointer; }

.btn {
  font: inherit; border-radius: 10px; padding: 9px 16px; border: 1px solid transparent;
  cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { background: #2157e0; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.wide { width: 100%; margin-top: 6px; }

.layout {
  display: grid; grid-template-columns: 390px minmax(0, 1fr); gap: 22px;
  padding: 22px 26px 8px; align-items: start; max-width: 1560px; margin: 0 auto;
}
.view.hidden { display: none; }

.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 20px;
}
.panel-title { margin: 0 0 14px; font-size: 14.5px; color: var(--muted); font-weight: 600; }
.form-panel { position: sticky; top: 86px; }

.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.field .hint { color: #a3aab5; font-size: 11px; }
.field .req { color: var(--away); font-size: 11px; }
.field input { width: 100%; }
.triple { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 8px; }
.row select { flex: 1; }
.data-box { background: #f8fafc; border: 1px dashed #c9d5e8; border-radius: 12px; padding: 12px; }
.data-box select { width: 100%; margin-top: 6px; }
.hint-line { font-size: 11px; color: #9aa2af; margin-top: 6px; line-height: 1.7; }
.form-foot { margin-top: 12px; font-size: 11px; color: #9aa2af; text-align: center; }

.result-panel { min-height: 620px; }
.empty { padding: 100px 30px; text-align: center; }
.empty-icon { font-size: 46px; color: #c6ceda; }
.empty-title { font-size: 18px; font-weight: 700; margin: 12px 0 8px; }
.empty-sub { font-size: 13px; color: var(--muted); line-height: 1.9; }

.error {
  background: #fff1ef; color: #b4341a; border: 1px solid #ffd4cb;
  border-radius: 12px; padding: 12px 16px; font-size: 13px;
}
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; padding: 24px 4px; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #d6deec; border-top-color: var(--blue); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

.result { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.result-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.r-match { margin: 0; font-size: 25px; letter-spacing: .5px; }
.r-kick { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.chip.light { background: #eef2f8; color: var(--muted); }
.chip.clean { background: var(--green); }
.chip.normal { background: var(--blue); }
.chip.noisy { background: var(--away); }
.chip.extreme { background: var(--purple); }

.prob-bar-wrap { margin: 22px 0 4px; }
.prob-bar { display: flex; height: 46px; border-radius: 12px; overflow: hidden; background: #eef2f8; }
.prob-seg { display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; font-size: 15px; }
.legend { display: flex; gap: 22px; margin-top: 10px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.legend b { color: var(--ink); }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 18px 0 16px; }
.stat { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.stat label { font-size: 11px; color: var(--muted); }
.stat b { font-size: 20px; }

.extra { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.extra-card { background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.extra-card h4 { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.extra-line { display: flex; gap: 18px; font-size: 13px; }
.extra-line b { font-size: 15px; }

.two-col { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 16px; }
.sub-card { background: #fbfcfe; border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.sub-card h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 700; }
.sub-card h3.mt { margin-top: 18px; }

.src-row { display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; margin-bottom: 10px; }
.src-name { font-size: 12px; font-weight: 700; }
.src-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; background: #eef2f8; }
.src-seg { height: 100%; }
.src-vals { grid-column: 2; font-size: 10.5px; color: #9aa2af; margin-top: -4px; }

.scores { display: flex; flex-direction: column; gap: 8px; }
.score-row { display: grid; grid-template-columns: 52px 1fr 50px; align-items: center; gap: 10px; font-size: 13px; }
.score-name { font-weight: 700; }
.score-track { height: 10px; background: #eef2f8; border-radius: 5px; overflow: hidden; }
.score-fill { height: 100%; background: linear-gradient(90deg, #7fa0ff, #2f6bff); border-radius: 5px; }
.score-pct { text-align: right; color: var(--muted); font-size: 12px; }

.matrix-wrap { overflow-x: auto; }
.matrix { border-collapse: separate; border-spacing: 2px; }
.matrix th { font-size: 10px; color: #9aa2af; font-weight: 600; padding: 2px 0; }
.matrix td { width: 46px; height: 40px; border-radius: 6px; text-align: center; font-size: 11px; font-weight: 600; }
.aux { margin-top: 12px; font-size: 11.5px; color: var(--muted); line-height: 1.9; }

.risks ul { margin: 0; padding-left: 18px; }
.risks li { font-size: 12.5px; color: #b4341a; line-height: 1.9; }

.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.png-preview { margin-bottom: 14px; }
.png-preview img { max-width: 420px; width: 100%; border-radius: 14px; border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(16,22,42,.12); }

.report { margin-top: 4px; }
.report summary { cursor: pointer; font-size: 13px; color: var(--blue); font-weight: 600; }
.report pre {
  white-space: pre-wrap; font-family: inherit; font-size: 12.5px; line-height: 2;
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; margin-top: 10px; color: #333;
}

/* 批量 */
.batch-panel, .history-panel { max-width: 1560px; margin: 22px auto 0; }
.batch-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.batch-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 10px; }
.match-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
  background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
}
.match-item:hover { border-color: #b9c9e6; }
.match-item input { margin-top: 3px; }
.match-main { min-width: 0; }
.match-name { font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.match-meta { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; margin-right: 4px; }
.pill.clean { background: #e7f6ec; color: var(--green); }
.pill.normal { background: #eaf0ff; color: var(--blue); }
.pill.noisy { background: #fdeee9; color: var(--away); }
.pill.extreme { background: #f3e8fd; color: var(--purple); }

/* 历史 */
.history-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.hs-card { background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.hs-card label { font-size: 11px; color: var(--muted); display: block; }
.hs-card b { font-size: 22px; }
.history-table-wrap { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: 12px; }
.history-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.history-table th { position: sticky; top: 0; background: var(--dark); color: #fff; padding: 10px 12px; text-align: left; font-weight: 600; }
.history-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.history-table tr:nth-child(even) td { background: #f8fafc; }
.history-table .brier-good { color: var(--green); font-weight: 700; }
.history-table .brier-bad { color: var(--away); font-weight: 700; }

.foot { text-align: center; color: #9aa2af; font-size: 11px; padding: 16px 20px 26px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .two-col { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .tabs { order: 3; }
}


/* ---------- 版本 / 模板 / 激活 ---------- */
.badge {
  display: inline-block; padding: 6px 11px; border-radius: 999px;
  background: #eef2f8; color: #6b7280; font-size: 12px; font-weight: 700;
}
.badge.pro { background: #e7f6ec; color: #16a34a; }
.badge.team { background: #f3e8fd; color: #9333ea; }
.template-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl {
  display: flex; flex-direction: column; gap: 2px; padding: 0 0 8px; border-radius: 10px; overflow: hidden;
  border: 1px solid var(--line); background: #fff; cursor: pointer; font-size: 12px;
}
.tpl-preview { width: 100%; height: 96px; object-fit: cover; object-position: top; display: block; background: #eef1f6; }
.tpl b { font-size: 12.5px; padding: 6px 10px 0; }
.tpl span { padding: 0 10px; }
.tpl b { font-size: 12.5px; }
.tpl span { color: #9aa2af; font-size: 10px; }
.tpl.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }
.tpl.locked { opacity: .55; }
.tpl .lock { color: #b45309; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(16,22,42,.55); display: grid; place-items: center; padding: 20px; }
.modal-card { width: min(520px, 94vw); background: #fff; border-radius: 18px; padding: 22px; box-shadow: 0 20px 60px rgba(16,22,42,.35); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.device-row { display: flex; align-items: center; gap: 10px; margin: 12px 0; flex-wrap: wrap; }
.device-row code { background: #f4f6f9; padding: 6px 10px; border-radius: 8px; font-size: 13px; }
.modal-card input { width: 100%; margin: 6px 0; }
.modal-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.brand-box { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 12px; }
.brand-box h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.foot a { color: var(--blue); text-decoration: none; }

.hit-text { color: #0a7d4f; font-weight: 700; }
.score-exact { color: #0a7d4f; font-weight: 700; }
.score-top3 { color: #b45309; font-weight: 700; }

.review-mode #btnLicense,
.review-mode #batchLock,
.review-mode #btnDaily { display: none !important; }

/* 海报主题选择器 */
.theme-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.theme-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; cursor: pointer; padding: 0 0 7px; }
.theme-card img { width: 100%; height: 92px; object-fit: cover; object-position: top; display: block; background: #eef1f6; }
.theme-card b { display: block; font-size: 12.5px; padding: 6px 8px 0; }
.theme-card span { display: block; color: #9aa2af; font-size: 10px; padding: 0 8px; }
.theme-card.active { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,107,255,.12); }

.theme-card[data-theme="paper"] { background: linear-gradient(135deg,#f7f4ec,#cfeff9 55%,#f6d8dc); }
.theme-card[data-theme="night"] { background: linear-gradient(135deg,#0a101e,#12233a 60%,#3a1426); }
.theme-card[data-theme="team"] { background: linear-gradient(135deg,#cdeffb,#fff 50%,#f2d7d9); }
.theme-card[data-theme="minimal"] { background: linear-gradient(135deg,#fff,#f2f2f2); }
.theme-card.no-preview { min-height: 120px; }
.theme-card.no-preview b, .theme-card.no-preview span { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.theme-card[data-theme="paper"].no-preview b, .theme-card[data-theme="paper"].no-preview span,
.theme-card[data-theme="team"].no-preview b, .theme-card[data-theme="team"].no-preview span,
.theme-card[data-theme="minimal"].no-preview b, .theme-card[data-theme="minimal"].no-preview span { color: #172033; text-shadow: none; }

/* ---------- 组合研究（专业版） ---------- */
.combo-panel {
  max-width: 1240px;
  margin: 24px auto 40px;
  padding: 26px 28px 24px;
}
.combo-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}
.combo-head .panel-title { margin: 0 0 6px; }
.combo-sub {
  margin: 0 0 18px;
  color: #687488;
  font-size: 13px;
  line-height: 1.7;
}
.combo-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid #e3e8f1;
  border-radius: 12px;
  background: #f8fafd;
}
.combo-toolbar label { color: #687488; font-size: 12px; }
.combo-toolbar select {
  min-width: 190px;
  padding: 9px 12px;
  border: 1px solid #dbe2ed;
  border-radius: 9px;
  background: #fff;
  color: #1b2438;
  font-size: 13px;
}
.combo-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.combo-kpi {
  padding: 14px 16px;
  border: 1px solid #e3e8f1;
  border-radius: 12px;
  background: #fff;
}
.combo-kpi label {
  display: block;
  color: #687488;
  font-size: 12px;
  margin-bottom: 7px;
}
.combo-kpi b { color: #172033; font-size: 25px; letter-spacing: -.02em; }
.combo-kpi small { color: #687488; font-size: 11px; margin-left: 4px; }
.combo-kpi .up { color: #cd4e44; }
.combo-kpi .down { color: #129169; }
.combo-chart-wrap {
  padding: 16px 16px 10px;
  border: 1px solid #e3e8f1;
  border-radius: 14px;
  background: #fff;
}
#comboChart { display: block; width: 100%; height: auto; }
.combo-note {
  margin: 12px 2px 16px;
  color: #687488;
  font-size: 12px;
  line-height: 1.7;
}
.combo-table-wrap { max-height: 330px; overflow: auto; }
.combo-foot { margin-top: 12px; color: #8a94a6; }
@media (max-width: 900px) {
  .combo-panel { margin: 14px 12px 28px; padding: 18px 14px 16px; }
  .combo-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .combo-head { flex-direction: column; gap: 4px; }
  .combo-toolbar select { flex: 1 1 100%; }
  .combo-chart-wrap { padding: 10px 6px 4px; }
}


/* ---------- 备案审核安全模式：公开访客看不到付费/专业版入口 ---------- */
body.review-mode:not(.owner-mode) #btnLicense,
body.review-mode:not(.owner-mode) #licenseModal,
body.review-mode:not(.owner-mode) #tabCombo,
body.review-mode:not(.owner-mode) #view-combo,
body.review-mode:not(.owner-mode) #btnDaily,
body.review-mode:not(.owner-mode) #btnBatchExport,
body.review-mode:not(.owner-mode) #batchLock,
body.review-mode:not(.owner-mode) .pro-cta {
  display: none !important;
}
