:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --text: #14212b;
  --muted: #62717e;
  --line: #dbe4e9;
  --line-strong: #c5d3da;
  --brand: #0f766e;
  --brand-soft: #e6f7f4;
  --hit: #0f766e;
  --miss: #b42318;
  --pending: #8a5a00;
  --shadow: 0 12px 30px rgba(20, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

button.secondary {
  background: #fff;
  color: var(--brand);
}

button:disabled {
  opacity: 0.58;
  cursor: wait;
}

.app {
  width: min(1240px, calc(100% - 32px));
  margin: 24px auto 40px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.metric,
.control-strip,
.date-row,
.match-card,
.empty {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.metric {
  padding: 16px;
  border-radius: 8px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metric strong {
  display: block;
  font-size: 26px;
  line-height: 1;
}

.control-strip {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr 1.4fr 1fr;
  gap: 14px;
  align-items: end;
  padding: 14px;
  border-radius: 8px;
  margin-bottom: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

select,
input[type="range"],
input[type="text"],
input:not([type]) {
  width: 100%;
}

select,
input[type="text"],
input:not([type]) {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.date-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.date-row h2 {
  font-size: 20px;
}

.date-row p {
  color: var(--muted);
  margin-top: 6px;
  font-size: 13px;
}

#completedBadge {
  white-space: nowrap;
  color: var(--brand);
  background: var(--brand-soft);
  border: 1px solid #b9e8df;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
}

.match-list {
  display: grid;
  gap: 12px;
}

.match-card {
  display: grid;
  grid-template-columns: 430px minmax(0, 1fr) 190px;
  gap: 18px;
  align-items: center;
  padding: 22px 18px;
  border-radius: 8px;
}

.match-card.hit {
  border-left: 5px solid var(--hit);
}

.match-card.miss {
  border-left: 5px solid var(--miss);
}

.match-card.pending {
  border-left: 5px solid var(--pending);
}

.teams {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.teams span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.teams strong {
  text-align: center;
  font-size: 28px;
  letter-spacing: 0;
}

.prediction {
  min-width: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.pill.hit {
  color: var(--hit);
  background: #e8f7f2;
}

.pill.miss {
  color: var(--miss);
  background: #fff0ed;
}

.pill.pending {
  color: var(--pending);
  background: #fff7e0;
}

.prediction h3 {
  font-size: 16px;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.prediction p {
  color: var(--muted);
  font-size: 14px;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.meta-line span {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 999px;
  padding: 5px 8px;
  color: var(--muted);
  font-size: 12px;
}

.review {
  justify-self: end;
  width: 100%;
}

.review summary {
  list-style: none;
  text-align: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 11px 12px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  background: #fff;
}

.review summary::-webkit-details-marker {
  display: none;
}

.review[open] {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.review[open] summary {
  width: 190px;
  margin-left: auto;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.review h4 {
  font-size: 14px;
  margin-bottom: 10px;
}

.prob-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  margin: 8px 0;
  font-size: 13px;
}

.prob-row span {
  overflow-wrap: anywhere;
}

.prob-row strong {
  text-align: right;
}

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

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.market-title {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.result-form {
  display: grid;
  grid-template-columns: 140px 120px minmax(160px, 1fr) minmax(180px, 1.2fr) 112px;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-form button {
  min-height: 40px;
  padding: 0 12px;
}

.result-form input:disabled,
.result-form select:disabled,
.result-form button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.form-hint,
.form-error {
  grid-column: 1 / -1;
  font-size: 12px;
}

.form-hint {
  color: var(--muted);
}

.form-error {
  color: var(--miss);
}

.empty {
  border-radius: 8px;
  padding: 36px 20px;
  display: grid;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty strong {
  color: var(--text);
}

@media (max-width: 900px) {
  .topbar,
  .date-row {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .control-strip,
  .match-card,
  .review-grid,
  .result-form {
    grid-template-columns: 1fr;
  }

  .match-card {
    padding: 16px;
  }

  .review,
  .review[open] summary {
    justify-self: stretch;
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100% - 20px, 1240px);
    margin-top: 14px;
  }

  h1 {
    font-size: 24px;
  }

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

  .teams {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .prob-row {
    grid-template-columns: 86px minmax(0, 1fr) 44px;
  }
}
