:root {
  color-scheme: light;
  --bg: #eef2ed;
  --surface: #ffffff;
  --surface-soft: #f7f9f6;
  --ink: #111815;
  --muted: #62706a;
  --line: #d9e1db;
  --field: #fbfcfa;
  --green: #14804a;
  --green-dark: #0b5132;
  --teal: #14747a;
  --gold: #c58a12;
  --red: #b54742;
  --charcoal: #17211d;
  --shadow: 0 20px 54px rgba(18, 30, 24, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    "PingFang SC",
    system-ui,
    sans-serif;
  background:
    linear-gradient(rgba(20, 128, 74, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 128, 74, 0.04) 1px, transparent 1px),
    linear-gradient(135deg, #f6f8f4 0%, #eef2ed 56%, #e9eee8 100%);
  background-size:
    28px 28px,
    28px 28px,
    auto;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.workspace {
  position: relative;
}

.topbar {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 18px;
  min-height: 108px;
  margin-bottom: 18px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(20, 128, 74, 0.2), transparent 42%),
    linear-gradient(120deg, #111815, #1c2b25 60%, #20352d);
  box-shadow: var(--shadow);
  color: #ffffff;
}

.platform-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 8px;
  color: #9fe1be;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(32px, 5vw, 58px);
  line-height: 0.98;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

.model-badge,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #edf8f1;
  backdrop-filter: blur(8px);
}

.model-badge {
  gap: 8px;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-chip {
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-width: 104px;
  padding: 7px 12px;
}

.status-chip strong {
  font-size: 18px;
  line-height: 1;
}

.status-chip span {
  margin-top: 3px;
  color: #b8c9c0;
  font-size: 11px;
  font-weight: 800;
}

.language-picker {
  min-width: 120px;
  display: grid;
  gap: 5px;
  color: #b8c9c0;
  font-size: 11px;
  font-weight: 900;
}

.language-picker select {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.language-picker option {
  color: var(--ink);
}

.badge-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #5cff9e;
  box-shadow: 0 0 0 5px rgba(92, 255, 158, 0.14);
}

.layout-grid {
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(560px, 1fr);
  gap: 18px;
  align-items: start;
}

.input-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.input-panel {
  position: sticky;
  top: 16px;
  padding: 18px;
}

.result-panel {
  padding: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-header.compact {
  margin-bottom: 12px;
}

.panel-header.secondary,
.news-wrap,
.reason-wrap,
.player-impact-wrap,
.score-table-wrap {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.panel-header span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ghost-button,
.primary-button {
  min-width: 64px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--green-dark);
  font-weight: 900;
  cursor: pointer;
}

.primary-button {
  border-color: var(--green);
  background: linear-gradient(180deg, #188d52, var(--green));
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.ghost-button:hover {
  border-color: rgba(20, 128, 74, 0.45);
  background: rgba(20, 128, 74, 0.08);
}

.primary-button:hover {
  border-color: var(--green-dark);
  background: linear-gradient(180deg, #157f49, var(--green-dark));
}

.data-panel {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid #d6e2da;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(20, 128, 74, 0.04), transparent),
    var(--surface-soft);
  margin-bottom: 6px;
}

.data-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.data-status {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 12px;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #edf5ef;
}

.online-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d6e2da;
  border-radius: 8px;
  background: #ffffff;
}

.online-panel strong {
  display: block;
  margin-bottom: 4px;
  color: var(--green-dark);
  font-size: 13px;
}

.online-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.toggle-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.toggle-row input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--green);
}

.data-status strong {
  color: var(--green-dark);
  font-size: 14px;
}

.data-status span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.backtest-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dbe7df;
  border-radius: 8px;
  background: #f7faf8;
}

.backtest-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.backtest-grid article {
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.backtest-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.backtest-grid strong {
  display: block;
  margin-top: 8px;
  color: var(--green-dark);
  font-size: 24px;
  line-height: 1;
}

.telegram-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.telegram-actions .ghost-button,
.telegram-actions .primary-button {
  min-height: 38px;
  padding-inline: 14px;
}

.result-actions {
  margin: -4px 0 14px;
}

.team-row,
.metric-grid {
  display: grid;
  gap: 12px;
}

.team-row {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 14px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: #55635d;
  font-size: 12px;
  font-weight: 900;
}

.button-label {
  align-content: end;
}

input[type="text"],
input[type="number"],
input[type="file"],
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #d4ded7;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input[type="file"] {
  min-height: auto;
  padding: 10px;
}

select {
  cursor: pointer;
}

select:disabled {
  color: #94a19a;
  cursor: not-allowed;
}

input:focus,
select:focus {
  border-color: rgba(20, 128, 74, 0.72);
  box-shadow: 0 0 0 3px rgba(20, 128, 74, 0.12);
}

.range-stack {
  display: grid;
  gap: 15px;
}

.range-stack label {
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #edf1ee;
}

.range-stack label:last-child {
  border-bottom: 0;
}

.range-stack input {
  grid-column: 1 / -1;
}

output {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
  cursor: pointer;
}

.scoreline {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  min-height: 186px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(197, 138, 18, 0.16), transparent 42%),
    linear-gradient(120deg, #17211d, #1f332b);
  color: #ffffff;
}

.scoreline p {
  color: #a9cbb8;
  font-size: 13px;
  font-weight: 900;
}

#predictedScore {
  display: block;
  margin-top: 12px;
  font-size: clamp(58px, 8vw, 100px);
  line-height: 0.9;
  letter-spacing: 0;
}

.confidence {
  min-width: 112px;
  display: grid;
  align-content: center;
  justify-items: end;
}

.confidence span,
.insight-grid span,
.probability-strip span,
.player-impact-grid span,
.player-item span,
.news-grid article > span,
.reason-item span,
.score-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.confidence span {
  color: #a9cbb8;
}

.confidence strong {
  margin-top: 7px;
  color: #5cff9e;
  font-size: 36px;
}

.probability-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.probability-strip article,
.insight-grid article,
.model-diagnostics article,
.player-impact-grid article,
.player-item,
.news-grid article,
.reason-item,
.score-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.probability-strip article {
  display: grid;
  gap: 9px;
  min-height: 112px;
  padding: 14px;
  border-top: 4px solid #dfe7e1;
}

.probability-strip article:nth-child(1) {
  border-top-color: var(--green);
}

.probability-strip article:nth-child(2) {
  border-top-color: var(--gold);
}

.probability-strip article:nth-child(3) {
  border-top-color: var(--teal);
}

.probability-strip strong {
  font-size: 32px;
  line-height: 1;
}

.bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eee9;
}

.bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  transition: width 180ms ease;
}

#homeBar {
  background: var(--green);
}

#drawBar {
  background: var(--gold);
}

#awayBar {
  background: var(--teal);
}

.insight-grid,
.model-diagnostics,
.player-impact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.insight-grid article,
.model-diagnostics article,
.player-impact-grid article {
  display: grid;
  gap: 8px;
  min-height: 86px;
  padding: 14px;
}

.model-diagnostics article {
  background: #f7faf8;
}

.insight-grid strong,
.model-diagnostics strong,
.player-impact-grid strong {
  font-size: 25px;
  line-height: 1;
}

.model-diagnostics strong {
  font-size: 21px;
}

.player-list,
.news-grid,
.reason-list,
.score-list {
  display: grid;
  gap: 10px;
}

.player-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.news-grid,
.reason-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

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

.player-item {
  min-height: 66px;
  padding: 12px;
}

.news-grid article,
.reason-item {
  min-height: 106px;
  padding: 14px;
}

.news-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.news-links a {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--green-dark);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.news-links a:hover {
  border-color: rgba(20, 128, 74, 0.45);
  background: rgba(20, 128, 74, 0.08);
}

.reason-item strong {
  display: block;
  margin: 7px 0;
  font-size: 22px;
}

.reason-item p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.55;
}

.player-item strong {
  display: block;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.score-item {
  min-height: 78px;
  padding: 12px;
}

.score-item strong {
  display: block;
  margin-bottom: 7px;
  font-size: 24px;
  line-height: 1;
}

@media (max-width: 1100px) {
  .layout-grid {
    grid-template-columns: 1fr;
  }

  .input-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding: 14px 0 28px;
  }

  .topbar,
  .scoreline {
    flex-direction: column;
  }

  .platform-status {
    justify-content: flex-start;
  }

  .status-chip {
    min-width: 94px;
  }

  .team-row,
  .metric-grid,
  .data-actions,
  .online-panel,
  .probability-strip,
  .insight-grid,
  .model-diagnostics,
  .player-impact-grid,
  .player-list,
  .backtest-grid,
  .news-grid,
  .reason-list,
  .score-list {
    grid-template-columns: 1fr;
  }

  .confidence {
    justify-items: start;
  }
}
