.seat {
  --ring: var(--team-them);

  position: relative;
  z-index: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;

  &.-us {
    --ring: var(--team-us);
  }

  &.-partner {
    grid-area: partner;
    justify-self: center;
    max-width: 46%;
  }

  &.-left {
    grid-area: left;
    align-self: center;
    justify-self: start;
    align-items: flex-start;
    max-width: 100%;
  }

  &.-right {
    grid-area: right;
    align-self: center;
    justify-self: end;
    align-items: flex-end;
    max-width: 100%;
  }

  & > .token {
    max-width: 100%;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 3px 10px 3px 3px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    border-radius: 999px;
  }

  & .avatar {
    position: relative;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 600;
    background: var(--felt-2);
    border-radius: 50%;
    box-shadow: inset 0 0 0 2px var(--ring);

    & > .dealer {
      position: absolute;
      right: -4px;
      bottom: -3px;
      width: 13px;
      height: 13px;
      display: grid;
      place-items: center;
      font-family: var(--font-ui);
      font-size: 8px;
      font-weight: 800;
      line-height: 1;
      color: var(--gold-ink);
      background: var(--cream);
      border-radius: 50%;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    }
  }

  & .meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.15;
  }

  & .name {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    & .dev-clickable-name {
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      text-decoration: none;
    }
  }

  & .role {
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--cream-dim);
    opacity: 0.62;
  }

  & > .fan {
    position: relative;
    width: calc(var(--back-w) + 14px);
    height: calc(var(--back-w) * 1.5);

    & > .back {
      position: absolute;
      top: 0;
      display: block;
      width: var(--back-w);
      aspect-ratio: 2 / 3;
      background: repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.14) 0 4px, transparent 4px 8px), var(--rust);
      border-radius: 6px;
      box-shadow: inset 0 0 0 1.5px var(--cream-dim), 0 1px 3px rgba(0, 0, 0, 0.4);

      &:nth-child(1) {
        left: 0;
        rotate: -4deg;
      }

      &:nth-child(2) {
        left: 6px;
      }

      &:nth-child(3) {
        left: 12px;
        rotate: 4deg;
      }
    }

    & > .count {
      position: absolute;
      right: -4px;
      bottom: -3px;
    }
  }

  & .count {
    flex: 0 0 auto;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--cream-dim);
    background: rgba(0, 0, 0, 0.34);
    border: 1px solid var(--line-soft);
    border-radius: 999px;
  }

  & > .bubble-slot {
    min-height: 17px;
    max-width: 100%;
    display: flex;
    align-items: center;
  }

  & .bubble {
    max-width: min(140px, 100%);
    padding: 3px 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--font-display);
    font-size: 11px;
    line-height: 1.1;
    color: var(--ink);
    background: var(--cream);
    border-radius: 999px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);

    &.-pass {
      color: var(--cream-dim);
      background: rgba(0, 0, 0, 0.34);
    }

    &.-win {
      font-weight: 600;
      color: var(--gold-ink);
      background: var(--gold);
    }
  }

  &.-active > .token {
    border-color: var(--gold);
    box-shadow: 0 0 0 1px var(--gold), 0 0 16px -2px rgba(216, 162, 74, 0.6);
  }

  &.-active .avatar {
    animation: seat-pulse 1.7s ease-in-out infinite;
  }
}

@keyframes seat-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 2px var(--ring);
  }

  50% {
    box-shadow: inset 0 0 0 2px var(--ring), 0 0 12px 1px rgba(216, 162, 74, 0.5);
  }
}

@container felt (max-width: 459.98px) or (max-height: 329.98px) {
  .seat {
    justify-self: stretch;
    align-self: start;
    align-items: center;
    max-width: none;
    gap: 2px;
    padding: 5px 6px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid var(--line);
    border-radius: 14px;

    &.-partner,
    &.-left,
    &.-right {
      justify-self: stretch;
      align-self: start;
      align-items: center;
      max-width: none;
    }

    & > .token,
    & > .fan {
      display: contents;
    }

    & > .fan > .back,
    & .role {
      display: none;
    }

    & .avatar {
      width: 24px;
      height: 24px;
      font-size: 12px;
    }

    & .meta {
      max-width: 100%;
      align-items: center;
    }

    & .name {
      max-width: 100%;
      font-size: 11px;
      text-align: center;
    }

    & > .fan > .count {
      top: 3px;
      right: 4px;
      bottom: auto;
      padding: 0 4px;
      font-size: 9px;
    }

    & > .bubble-slot {
      min-height: 0;
      justify-content: center;
    }

    & .bubble {
      padding: 2px 7px;
      font-size: 10px;
    }

    &.-active {
      border-color: var(--gold);
      box-shadow: 0 0 0 1px var(--gold), 0 0 16px -2px rgba(216, 162, 74, 0.6);
    }
  }

  @container table (max-height: 459.98px) {
    .seat {
      flex-direction: row;
      gap: 5px;
      padding: 3px 22px 3px 3px;
      border-radius: 999px;

      & .meta {
        flex: 1 1 auto;
        align-items: flex-start;
      }

      & .name {
        text-align: left;
      }

      & > .bubble-slot {
        flex: 0 0 auto;
      }

      & > .fan > .count {
        top: 50%;
        transform: translateY(-50%);
      }
    }
  }
}
