:root {
  --bg: #0b1120; --card: #111a2e; --card2: #16213a; --line: #1f2d4a;
  --text: #e6edf7; --muted: #8aa0c0; --primary: #2563eb; --accent: #f59e0b;
  --up: #ef4444; --down: #22c55e; --win: #22c55e; --lose: #ef4444; --push: #94a3b8;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; font-size: 15px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.tip { margin-top: 10px; line-height: 1.5; }
.error { color: #fca5a5; font-size: 13px; margin: 6px 0; min-height: 16px; }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: #0f172a; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; letter-spacing: .5px; }
.status { font-size: 12px; color: var(--muted); }

main { max-width: 920px; margin: 0 auto; padding: 14px; padding-bottom: 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
.card h2 { margin: 0 0 10px; font-size: 16px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.upload-row { margin-top: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field.checkbox { flex-direction: row; align-items: center; gap: 6px; }
input, select { background: var(--card2); border: 1px solid var(--line); color: var(--text);
  border-radius: 9px; padding: 9px 11px; font-size: 15px; }
input:focus, select:focus { outline: none; border-color: var(--primary); }

button { border: none; border-radius: 9px; padding: 10px 16px; font-size: 14px; font-weight: 600; cursor: pointer; color: #fff; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--primary); }
button.accent { background: var(--accent); color: #1a1206; }
button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
button.small { padding: 6px 12px; font-size: 12.5px; }
button.danger { background: transparent; border: 1px solid #5b2330; color: #fca5a5; }

/* 步骤指示 */
.steps { display: flex; gap: 6px; margin-bottom: 12px; font-size: 12.5px; }
.steps span { flex: 1; text-align: center; padding: 7px 4px; border-radius: 8px; background: var(--card); color: var(--muted); border: 1px solid var(--line); }
.steps span.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.steps span.done { color: #86efac; border-color: #1f4a33; }

.thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.thumb { position: relative; }
.thumb img { width: 76px; height: 76px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.thumb .x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: #1f2d4a; color: #fff; font-size: 13px; line-height: 20px; text-align: center; border: 1px solid var(--line); }

.busy { display: flex; align-items: center; gap: 10px; padding: 12px 4px; color: var(--muted); }
.spinner { width: 20px; height: 20px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 复核可编辑 */
.review-img { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.review-img .hd { padding: 10px 12px; background: var(--card2); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.review-row { display: grid; grid-template-columns: 1.4fr 0.8fr 1.6fr 1.6fr 1fr 1fr 28px; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); align-items: center; }
.review-row input { padding: 7px 8px; font-size: 13px; width: 100%; }
.review-row .lbl { display: none; }
.review-head { font-size: 11px; color: var(--muted); }
.review-img .ft { padding: 8px 10px; }
@media (max-width: 640px) {
  .review-head { display: none; }
  .review-row { grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 10px; position: relative; }
  .review-row .lbl { display: block; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
  .review-row .cell { display: flex; flex-direction: column; }
  .review-row .cell.teamh, .review-row .cell.teama { grid-column: span 1; }
  .review-row .del { position: absolute; top: 6px; right: 6px; }
}

/* 预测结果 */
.image-block { border: 1px solid var(--line); border-radius: 14px; margin-bottom: 14px; overflow: hidden; }
.verdict { padding: 16px 14px; background: linear-gradient(180deg, var(--card2), var(--card)); }
.verdict .fname { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.verdict .big { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.verdict .side { font-size: 22px; font-weight: 800; }
.side-up { color: #fda4a4; } .side-down { color: #86efac; }
.verdict .pwin { font-size: 30px; font-weight: 800; line-height: 1; }
.verdict .pwin small { font-size: 13px; font-weight: 600; color: var(--muted); }
.prob-bar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; margin: 12px 0 6px; background: var(--card2); }
.prob-bar .w { background: var(--win); } .prob-bar .p { background: var(--push); } .prob-bar .l { background: var(--lose); }
.prob-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.prob-legend b { color: var(--text); }
.metrics { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.metrics b { color: var(--text); }

.choice-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 14px; background: var(--card2); border-top: 1px solid var(--line); }
.choice-row select { flex: 1; min-width: 150px; }
.saved-tag { font-size: 12px; color: var(--down); }

details.detail { padding: 0 14px 12px; }
details.detail summary { cursor: pointer; color: var(--muted); font-size: 13px; padding: 10px 0; }
table.matches { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.matches th, table.matches td { padding: 7px 5px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.matches th { color: var(--muted); font-weight: 600; font-size: 11px; }
table.matches td.team { text-align: left; white-space: normal; min-width: 84px; }
.pred { font-weight: 700; } .pred-up { color: #fca5a5; } .pred-down { color: #86efac; }
.tag { display: inline-block; font-size: 10.5px; padding: 1px 6px; border-radius: 6px; background: var(--card2); color: var(--muted); }
.tag.ok { color: #86efac; } .tag.no { color: #fca5a5; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.state-win, .profit-pos { color: var(--win); font-weight: 700; }
.state-lose, .profit-neg { color: var(--lose); font-weight: 700; }
.state-push { color: var(--push); }
.summary-line { display: flex; gap: 14px; flex-wrap: wrap; padding: 10px 14px; font-size: 13px; color: var(--muted); background: var(--card); border-top: 1px solid var(--line); }
.summary-line b { color: var(--text); }
.settle-bar { padding: 12px 14px; }

.history-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.history-item:last-child { border-bottom: none; }
.history-item .meta { font-size: 12px; color: var(--muted); }

.foot { max-width: 920px; margin: 0 auto; padding: 16px; text-align: center; line-height: 1.6; }
