:root {
  color-scheme: light;
  --background: #f5f5f1;
  --surface: #fff;
  --ink: #1c2820;
  --muted: #7b827d;
  --line: #e3e6e1;
  --green: #37684b;
  --green-soft: #eaf1ec;
  --red: #b96355;
  --draw: #8a908c;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

html.intro-pending,
html.intro-pending body {
  overflow: hidden;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--background);
}

button,
select {
  font: inherit;
}

button:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.visually-hidden,
.team-identity label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f1f2ed;
  pointer-events: none;
}

.intro-wordmark {
  position: relative;
  z-index: 2;
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 4rem);
  font-weight: 760;
  letter-spacing: -0.065em;
}

.intro-wordmark span,
.brand span {
  color: var(--red);
}

#intro-ball {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  width: min(70vw, 70vh);
  transform: translate(-50%, -50%) scale(1.15) rotate(-8deg);
  opacity: 0.2;
  filter: drop-shadow(0 22px 30px rgba(28, 40, 32, 0.12));
}

.site-header,
main {
  width: min(960px, calc(100% - 40px));
  margin-inline: auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 74px;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.league-mark {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#header-ball {
  width: 31px;
  height: 31px;
  object-fit: contain;
  filter: drop-shadow(0 5px 6px rgba(28, 40, 32, 0.12));
}

main {
  padding: 48px 0 64px;
}

.match-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 64px 1fr;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: opacity 160ms ease;
}

.match-card.is-loading {
  opacity: 0.64;
}

.team-panel {
  min-width: 0;
  padding: 30px 30px 28px;
}

.venue-label,
.recent-form > p,
.verdict > span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 0.63rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.team-identity {
  display: grid;
  grid-template-columns: 70px 1fr;
  align-items: center;
  gap: 20px;
  margin: 20px 0 34px;
}

.club-crest {
  position: relative;
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
}

.club-crest img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}

.crest-fallback {
  display: none;
  font-weight: 760;
}

.club-crest.is-fallback img {
  display: none;
}

.club-crest.is-fallback .crest-fallback {
  display: block;
}

.select-wrap {
  position: relative;
  min-width: 0;
}

.select-wrap > span {
  position: absolute;
  top: 50%;
  right: 14px;
  color: var(--muted);
  transform: translateY(-55%);
  pointer-events: none;
}

select {
  width: 100%;
  height: 48px;
  padding: 0 38px 0 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  appearance: none;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 680;
}

select:hover:not(:disabled),
select:focus-visible {
  border-color: #aeb8b1;
}

select:disabled {
  cursor: wait;
  opacity: 0.55;
}

.versus {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.versus > span {
  color: #99a09b;
  font-size: 0.65rem;
  font-weight: 750;
}

.versus button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--green);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

.versus button:hover {
  background: var(--green-soft);
  transform: rotate(180deg);
}

.recent-form > p {
  margin-bottom: 7px;
}

.recent-form ol {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.recent-form li {
  display: grid;
  grid-template-columns: 19px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 37px;
  border-bottom: 1px solid var(--line);
  font-size: 0.75rem;
}

.result-badge {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  color: var(--draw);
  border: 1px solid #cfd3d0;
  border-radius: 50%;
  font-size: 0.55rem;
  font-weight: 800;
}

.result-w .result-badge {
  color: var(--green);
  border-color: #9db9a7;
}

.result-l .result-badge {
  color: var(--red);
  border-color: #d6aaa3;
}

.opponent {
  overflow: hidden;
  color: #59615b;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-form strong {
  font-size: 0.73rem;
  font-weight: 680;
  font-variant-numeric: tabular-nums;
}

.error-message {
  margin-top: 12px;
  padding: 11px 14px;
  color: #8d4035;
  background: #f5e9e6;
  border: 1px solid #ecd8d4;
  border-radius: 8px;
  font-size: 0.78rem;
}

.prediction-card {
  display: grid;
  grid-template-columns: 0.38fr 1fr;
  gap: 34px;
  margin-top: 12px;
  padding: 25px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.verdict {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
}

.verdict h2 {
  margin: 5px 0 0;
  color: var(--green);
  font-size: clamp(1.45rem, 3vw, 2rem);
  font-weight: 720;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.probabilities {
  display: grid;
  gap: 12px;
}

.probability > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 5px;
  color: #646c66;
  font-size: 0.72rem;
}

.probability strong {
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.bar {
  height: 3px;
  overflow: hidden;
  background: #edf0ed;
  border-radius: 99px;
}

.bar > span {
  display: block;
  width: 0;
  height: 100%;
  background: #aab1ac;
  border-radius: inherit;
  transition: width 500ms ease;
}

.probability.is-winner > div:first-child span,
.probability.is-winner strong {
  color: var(--green);
}

.probability.is-winner .bar > span {
  background: #759f82;
}

@media (max-width: 720px) {
  .site-header,
  main {
    width: min(100% - 24px, 560px);
  }

  .site-header {
    height: 66px;
  }

  .league-mark > span {
    display: none;
  }

  main {
    padding: 26px 0 42px;
  }

  .match-card {
    grid-template-columns: 1fr;
  }

  .team-panel {
    padding: 25px 24px;
  }

  .team-identity {
    margin: 15px 0 26px;
  }

  .versus {
    flex-direction: row;
    height: 54px;
    border-top: 1px solid var(--line);
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

  .prediction-card {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 24px;
  }

  .verdict {
    padding-bottom: 20px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  #intro-ball {
    width: min(88vw, 62vh);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
