.team-form {
  --form-win: #22c55e;
  --form-draw: #f59e0b;
  --form-loss: #ef4444;
  --form-empty: #e5e7eb;
  position: relative;
  display: inline-flex;
  margin-top: 4px;
}

.team-form__trigger {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px;
  background: none;
  border: 0;
  cursor: pointer;
  line-height: 0;
}

.team-form__trigger:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.team-form__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.team-form__dot--win   { background: var(--form-win); }
.team-form__dot--draw  { background: var(--form-draw); }
.team-form__dot--loss  { background: var(--form-loss); }
.team-form__dot--empty { background: var(--form-empty); }

.team-form-tooltip {
  --arrow-x: 50%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  min-width: 240px;
  max-width: min(360px, calc(100vw - 16px));
  background: var(--white);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 12px;
}

.team-form-tooltip[hidden] {
  display: none;
}

.team-form-tooltip::before {
  content: '';
  position: absolute;
  top: -7px;
  left: var(--arrow-x);
  width: 12px;
  height: 8px;
  background: var(--white);
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 0 100%, 100% 100%);
}

.team-form-tooltip::after {
  content: '';
  position: absolute;
  top: -8px;
  left: 0;
  width: 100%;
  height: 8px;
}

.team-form-tooltip__list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.team-form-tooltip__row {
  border-radius: 8px;
}

.team-form-tooltip__row:hover {
  background: var(--grey-light);
}

.team-form-tooltip__match {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 10px;
  row-gap: 2px;
  padding: 6px 8px;
  color: var(--text);
  text-decoration: none;
}

.team-form-tooltip__marker {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  grid-row: span 2;
  align-self: center;
}

.team-form-tooltip__row--win  .team-form-tooltip__marker { background: var(--form-win); }
.team-form-tooltip__row--draw .team-form-tooltip__marker { background: var(--form-draw); }
.team-form-tooltip__row--loss .team-form-tooltip__marker { background: var(--form-loss); }

.team-form-tooltip__teams {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 14px;
  line-height: 1.3;
}

.team-form-tooltip__team {
  color: var(--text);
}

.team-form-tooltip__score {
  font-weight: 700;
}

.team-form-tooltip__date {
  font-size: 12px;
  color: var(--grey);
}

.team-form-tooltip__match:hover .team-form-tooltip__team {
  color: var(--primary);
}

.pe-card__team-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

@media (hover: none) {
  .team-form-tooltip__row:hover {
    background: transparent;
  }
  .team-form-tooltip__match:hover .team-form-tooltip__team {
    color: var(--text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .team-form-tooltip {
    transition: none;
  }
}

@media print {
  .team-form-tooltip {
    display: none !important;
  }
}
