:root {
  color-scheme: dark;
  --bg: #071018;
  --panel: rgba(16, 29, 40, .86);
  --panel-2: rgba(24, 42, 54, .78);
  --line: rgba(167, 210, 226, .15);
  --text: #f4f7f8;
  --muted: #91a6b0;
  --gold: #ffc85a;
  --cyan: #4cdbdc;
  --green: #55e69b;
  --red: #ff6d79;
  --radius: 20px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 80% 0%, rgba(16, 110, 132, .25), transparent 35rem),
    radial-gradient(circle at 10% 40%, rgba(198, 133, 37, .11), transparent 30rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
}
button, input, select { font: inherit; }
button, .button-label {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 15px;
  background: rgba(255,255,255,.055);
  color: var(--text);
  cursor: pointer;
  transition: .2s ease;
}
button:hover, .button-label:hover { border-color: var(--cyan); transform: translateY(-1px); }
.primary { background: linear-gradient(135deg, #167f86, #2b9e8c); border-color: transparent; font-weight: 700; }
.danger-ghost { color: #ff9da5; }
.button-label input { display: none; }
input, select {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: #0d1a24;
  color: var(--text);
}

.hero { height: min(53vw, 610px); min-height: 330px; position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero img { width: 100%; height: 100%; object-fit: cover; object-position: center 40%; }
.hero-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(2,8,12,.03) 15%, rgba(2,8,12,.25) 55%, var(--bg) 100%); }
.hero-copy { position: absolute; left: max(24px, calc((100vw - 1240px) / 2)); bottom: 44px; text-shadow: 0 3px 18px #000; }
.hero-copy h1 { margin: 8px 0; font-size: clamp(32px, 5vw, 70px); letter-spacing: -.05em; }
.hero-copy p:last-child { color: #d4e3e7; font-size: clamp(14px, 1.5vw, 19px); }
.eyebrow { margin: 0; color: var(--gold); font-size: 11px; font-weight: 800; letter-spacing: .22em; }

main { width: min(1240px, calc(100% - 32px)); margin: -10px auto 80px; position: relative; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); backdrop-filter: blur(18px); box-shadow: 0 20px 50px rgba(0,0,0,.16); }
.toolbar { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 18px; }
.toolbar-actions, .filters { display: flex; gap: 9px; flex-wrap: wrap; }
.field-label { display: block; color: var(--muted); font-size: 12px; margin: 0 0 7px 3px; }
.auto-score-status { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; }
.auto-score-status.success { color: var(--green); }
.auto-score-status.warning { color: var(--gold); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin: 16px 0 46px; }
.stat-card { padding: 18px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 16px; }
.stat-card span { color: var(--muted); font-size: 12px; }
.stat-card strong { display: block; margin-top: 6px; font-size: 27px; }

.section-block { margin-top: 52px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 17px; }
.section-title h2 { margin: 7px 0 0; font-size: 29px; }
.section-title > p { color: var(--muted); font-size: 13px; }
.ranking-actions { display: flex; align-items: center; gap: 12px; }
.ranking-actions p { color: var(--muted); font-size: 13px; }
.podium { display: grid; grid-template-columns: repeat(3, 1fr); align-items: end; gap: 13px; margin: 0 10% 17px; }
.podium-card { position: relative; overflow: hidden; min-height: 250px; border: 1px solid var(--line); border-radius: 20px; background: #10202a; }
.agent-link { cursor: pointer; transition: border-color .2s ease, background .2s ease, transform .2s ease; }
.agent-link:hover { border-color: rgba(76,219,220,.55); background-color: rgba(76,219,220,.045); transform: translateY(-2px); }
.podium-card:first-child { order: 2; min-height: 310px; border-color: rgba(255, 200, 90, .55); }
.podium-card:nth-child(2) { order: 1; }
.podium-card:nth-child(3) { order: 3; }
.podium-card img { width: 100%; height: 100%; position: absolute; object-fit: cover; object-position: center; opacity: .68; }
.podium-info { position: absolute; inset: auto 0 0; padding: 45px 16px 16px; background: linear-gradient(transparent, rgba(3,9,13,.98)); }
.podium-info b { color: var(--gold); font-size: 12px; }
.podium-info strong { display: block; font-size: 21px; margin-top: 3px; }
.podium-info span { color: var(--muted); font-size: 12px; }

.leaderboard { overflow: hidden; }
.rank-row { display: grid; grid-template-columns: 52px 52px 1fr repeat(3, 100px); align-items: center; gap: 14px; padding: 12px 17px; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border: 0; }
.rank-row.header { color: var(--muted); font-size: 11px; padding-block: 10px; }
.rank-number { color: var(--gold); font-size: 18px; font-weight: 900; text-align: center; }
.rank-avatar { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; object-position: center; border: 1px solid var(--line); }
.rank-name strong { display: block; }
.rank-name span { color: var(--muted); font-size: 11px; }
.rank-metric { text-align: center; }
.rank-metric strong { display: block; }
.rank-metric span { color: var(--muted); font-size: 10px; }

.matches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.match-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; transition: border-color .2s ease, transform .2s ease; }
.match-card.has-predictions { cursor: pointer; }
.match-card.has-predictions:hover { border-color: rgba(76, 219, 220, .45); }
.match-card.expanded { grid-column: 1 / -1; border-color: rgba(76, 219, 220, .5); cursor: pointer; }
.match-top { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 11px; }
.status { color: var(--gold); }
.status.complete { color: var(--green); }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; margin: 25px 0 21px; }
.team { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 900; }
.team strong { color: #fff; text-shadow: 0 2px 12px rgba(0,0,0,.7); }
.home-team { justify-content: flex-end; text-align: right; }
.away-team { justify-content: flex-start; text-align: left; }
.flag-image { width: 48px; height: 30px; object-fit: cover; border-radius: 3px; box-shadow: 0 4px 9px rgba(0,0,0,.45); }
.score { font-size: 28px; font-weight: 900; color: var(--gold); white-space: nowrap; }
.match-summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-top: 1px solid var(--line); padding-top: 13px; }
.match-summary span { color: var(--muted); font-size: 11px; }
.hit-names { color: var(--green) !important; max-width: 60%; text-align: right; }
.card-actions { display: flex; gap: 8px; margin-top: 13px; }
.card-actions button { flex: 1; padding: 8px; font-size: 12px; }
.screenshot-button { color: var(--gold); border-color: rgba(255,200,90,.35); }
.daily-agent-tabs { display: grid; grid-template-columns: repeat(10, 1fr); gap: 8px; padding: 12px; margin-bottom: 14px; }
.daily-agent-tab { min-width: 0; display: grid; justify-items: center; gap: 6px; padding: 10px 5px; }
.daily-agent-tab.active { border-color: var(--gold); background: rgba(255,200,90,.08); }
.daily-agent-tab img { width: 54px; height: 54px; border-radius: 50%; object-fit: cover; }
.daily-agent-tab strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.daily-predictions { padding: 18px; }
.daily-player-head { display: flex; align-items: center; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.daily-player-head img { width: 74px; height: 74px; border-radius: 50%; object-fit: cover; }
.daily-player-head strong, .daily-player-head span { display: block; }
.daily-player-head strong { font-size: 24px; }
.daily-player-head span { color: var(--muted); margin-top: 4px; font-size: 12px; }
.daily-group-title { display: flex; justify-content: space-between; margin: 20px 0 10px; }
.daily-group-title span { color: var(--muted); font-size: 12px; }
.daily-record-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.daily-record { display: grid; grid-template-columns: 78px 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.025); }
.daily-record > span { color: var(--muted); font-size: 11px; }
.daily-record strong { color: #fff; }
.daily-record b { color: var(--gold); font-size: 22px; white-space: nowrap; }
.match-predictions { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); cursor: default; }
.prediction-detail-head { display: flex; justify-content: space-between; align-items: center; gap: 15px; margin-bottom: 13px; }
.prediction-detail-head span { color: var(--muted); font-size: 11px; }
.prediction-results { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.prediction-result { min-width: 0; position: relative; display: grid; justify-items: center; gap: 6px; padding: 13px 8px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); text-align: center; }
.prediction-result.hit { border-color: rgba(85, 230, 155, .55); background: rgba(85, 230, 155, .07); }
.prediction-result img { width: 76px; height: 76px; object-fit: cover; border-radius: 50%; border: 2px solid rgba(255,255,255,.2); }
.prediction-result span { color: #fff; font-size: 15px; font-weight: 800; }
.prediction-result strong { color: var(--gold); font-size: 25px; line-height: 1; white-space: nowrap; }
.prediction-result.unpredicted strong { color: var(--muted); font-size: 13px; }
.prediction-result b { color: var(--green); font-size: 10px; }
.prediction-result.has-analysis { cursor: pointer; }
.prediction-result.has-analysis:hover { border-color: var(--gold); transform: translateY(-2px); }
.empty { grid-column: 1 / -1; padding: 50px; text-align: center; }
.empty span { display: block; color: var(--muted); margin-top: 7px; }

dialog { width: min(600px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 22px; padding: 0; background: #0b1720; color: var(--text); box-shadow: 0 30px 100px #000; }
dialog::backdrop { background: rgba(0, 5, 8, .72); backdrop-filter: blur(7px); }
.wide-dialog { width: min(820px, calc(100% - 28px)); }
dialog form { padding: 22px; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; margin-bottom: 18px; }
.dialog-head h3 { margin: 5px 0 0; font-size: 23px; }
.icon-button { padding: 3px 10px; font-size: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label, .prediction-row label { color: var(--muted); font-size: 11px; }
.form-grid input { width: 100%; display: block; margin-top: 6px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 22px; }
.prediction-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-height: 48vh; overflow: auto; padding-right: 3px; }
.prediction-row { display: grid; grid-template-columns: 58px 1fr auto; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 13px; }
.prediction-row img { width: 58px; height: 58px; border-radius: 50%; object-fit: cover; object-position: center; }
.score-inputs { display: flex; gap: 5px; align-items: center; }
.score-inputs input { width: 48px; padding: 8px 5px; text-align: center; }
.result-entry { display: grid; grid-template-columns: 1fr 1.8fr auto; align-items: center; gap: 12px; margin-top: 16px; padding: 14px; border: 1px solid rgba(255,200,90,.28); background: rgba(255,200,90,.055); border-radius: 14px; }
.result-entry span { color: var(--muted); font-size: 11px; }
.agent-dialog { width: min(1050px, calc(100% - 28px)); }
.agent-dialog-head { display: flex; align-items: start; justify-content: space-between; padding: 22px 22px 0; }
.agent-dialog-head h3 { margin: 5px 0 0; font-size: 30px; }
#agent-profile { padding: 20px 22px 0; }
.agent-profile-hero { display: grid; grid-template-columns: 320px 1fr; gap: 25px; }
.agent-profile-hero > img { width: 320px; height: 400px; object-fit: cover; border-radius: 22px; border: 1px solid var(--line); }
.agent-profile-copy { align-self: center; }
.agent-profile-copy h4 { margin: 10px 0 5px; font-size: 50px; }
.agent-profile-copy p { color: var(--muted); }
.agent-alias { display: block; color: var(--gold); margin-top: -4px; font-size: 18px; }
.agent-style { margin: 15px 0; padding: 12px; border-left: 3px solid var(--cyan); background: rgba(76,219,220,.05); color: #d8e5e8; line-height: 1.65; }
.agent-style span { display: block; color: var(--cyan); font-size: 10px; font-weight: 800; }
.agent-top { color: var(--gold); font-size: 22px; font-weight: 900; }
.agent-metrics { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 25px; }
.agent-metrics div { padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); }
.agent-metrics span { color: var(--muted); font-size: 11px; }
.agent-metrics strong { display: block; color: var(--gold); margin-top: 5px; font-size: 29px; }
.agent-records-head { display: flex; justify-content: space-between; margin: 22px 0 10px; }
.agent-records-head span { color: var(--muted); font-size: 12px; }
.agent-prediction-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 22px; }
.agent-prediction-stats div { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.agent-prediction-stats span { display: block; color: var(--muted); font-size: 11px; }
.agent-prediction-stats strong { display: block; margin-top: 4px; color: var(--gold); font-size: 25px; }
.agent-records { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 15px; }
.pending-records { max-height: 210px; border-color: rgba(255,200,90,.25); }
.agent-record { display: grid; grid-template-columns: 90px 1fr 130px; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); align-items: center; }
.agent-record.pending { background: rgba(255,200,90,.045); }
.agent-record.pending b { color: var(--gold); }
.agent-record:last-child { border: 0; }
.agent-record span { color: var(--muted); font-size: 11px; }
.agent-record b { color: var(--muted); text-align: right; font-size: 11px; }
.agent-record.hit b { color: var(--green); }
.agent-no-records { padding: 35px; color: var(--muted); text-align: center; }
.agent-dialog-actions { padding: 0 22px 22px; }
.profile-style-label { display: block; color: var(--muted); font-size: 11px; margin-top: 14px; }
.profile-style-label textarea { width: 100%; margin-top: 6px; resize: vertical; }
#analysis-dialog { width: min(680px, calc(100% - 28px)); }
.analysis-dialog-head { display: flex; justify-content: space-between; padding: 22px 22px 0; }
.analysis-dialog-head h3 { margin: 5px 0 0; font-size: 23px; }
#analysis-content { padding: 20px 22px 0; }
.analysis-agent { display: flex; gap: 14px; align-items: center; }
.analysis-agent img { width: 85px; height: 85px; object-fit: cover; border-radius: 50%; }
.analysis-agent strong, .analysis-agent span { display: block; }
.analysis-agent span { color: var(--muted); margin-top: 5px; font-size: 12px; }
.analysis-match { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 22px 0; padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel-2); font-size: 20px; }
.analysis-reason { padding: 18px; border-left: 3px solid var(--gold); background: rgba(255,200,90,.06); border-radius: 0 14px 14px 0; }
.analysis-reason span { color: var(--gold); font-size: 11px; font-weight: 800; }
.analysis-reason p { margin: 8px 0 0; line-height: 1.8; color: #e5ecee; }
.analysis-reason a { display: inline-block; margin-top: 12px; color: var(--cyan); font-size: 12px; }
.analysis-actions { padding: 0 22px 22px; }
.read-only .toolbar-actions, .read-only #edit-agent-profile { display: none; }
.read-only .toolbar { justify-content: flex-start; }

@media (max-width: 780px) {
  .hero { height: 430px; }
  .hero img { object-position: center; }
  .toolbar, .section-title { align-items: stretch; flex-direction: column; }
  .toolbar-actions button, .toolbar-actions .button-label { flex: 1; text-align: center; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .podium { margin-inline: 0; grid-template-columns: 1fr; }
  .podium-card, .podium-card:first-child { order: initial; min-height: 220px; }
  .leaderboard { overflow-x: auto; }
  .rank-row { min-width: 650px; }
  .matches { grid-template-columns: 1fr; }
  .prediction-results { grid-template-columns: repeat(2, 1fr); }
  .daily-agent-tabs { grid-template-columns: repeat(5, 1fr); }
  .daily-record-grid { grid-template-columns: 1fr; }
  .form-grid, .prediction-fields { grid-template-columns: 1fr; }
  .result-entry { grid-template-columns: 1fr; }
  .agent-profile-hero { grid-template-columns: 1fr; }
  .agent-profile-hero > img { width: 100%; height: 420px; }
  .agent-record { grid-template-columns: 75px 1fr; }
  .agent-prediction-stats { grid-template-columns: repeat(2, 1fr); }
  .agent-record b { grid-column: 2; text-align: left; }
}
